English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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-11 (09:33)
From: Sven LUTHER <luther@d...>
Subject: Cost of polymorphic variants over normal ones.
On Wed, Jan 10, 2001 at 01:25:27PM -0500, Norman Ramsey wrote:
> 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.

A (somewhat) related question would be, what is the cost of polymorphic
variants compared to noarmal ones ?

The normal variants are coded as integers, and using them is fast, while
polymorphic variants use some kind of hash functionn, but very simple.

If i use a datatype that i will be pattern matching very often and i want it
to be quick, how much is the overhead of using polymorphic patterns over
noraml ones ?

Or did i misunderstand the way it works ?


Sven Luther