Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
questions about costs of nativeint vs int
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-01-10 (18:57)
From: Norman Ramsey <nr@e...>
Subject: questions about costs of nativeint vs int
We're designing interfaces for tools that will sometimes have to
manipulate 32-bit integers, but will often be able to make do with the
limited precision provided by the int type.  I would love to get some
information about the relative cost of int vs nativeint in both
parameter passing and datatype representation.

For example, what are the relative costs (e.g., memory requirements)
of these two definitions?

  type loc = Cell of char * int * width
           | Slice of ...

  type loc' = Cell of char * nativeint * width
            | Slice of ...

As another example, what are the costs of calling these functions:

  type t
  val add  : rd:int       -> rs1:int       -> rs2:int       -> t
  val add' : rd:nativeint -> rs1:nativeint -> rs2:nativeint -> t

To extend the question, what happens if I use int32 or int64 in place
of nativeint?

Finally, a procedural question: should I be posting these sorts of
questions to instead of sending them to

Thanks in advance for any help!