From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA04271 for caml-red; Thu, 11 Jan 2001 10:33:03 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA18544 for ; Thu, 11 Jan 2001 10:18:57 +0100 (MET) Received: from dpt-info.u-strasbg.fr (dpt-info.u-strasbg.fr [130.79.6.1]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f0B9IuT00136 for ; Thu, 11 Jan 2001 10:18:56 +0100 (MET) Received: from lambda.u-strasbg.fr (lambda.u-strasbg.fr [130.79.90.63]) by dpt-info.u-strasbg.fr (8.9.3/8.9.3) with ESMTP id KAA07780 for ; Thu, 11 Jan 2001 10:18:43 +0100 Received: from luther by lambda.u-strasbg.fr with local (Exim 3.20 #1 (Debian)) id 14Gdqx-0000y3-00 for ; Thu, 11 Jan 2001 10:17:03 +0100 Date: Thu, 11 Jan 2001 10:17:03 +0100 To: caml-list@inria.fr Subject: Cost of polymorphic variants over normal ones. Message-ID: <20010111101703.A3683@lambda.u-strasbg.fr> References: <200101101825.NAA17093@labrador.eecs.harvard.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.12i In-Reply-To: <200101101825.NAA17093@labrador.eecs.harvard.edu>; from nr@eecs.harvard.edu on Wed, Jan 10, 2001 at 01:25:27PM -0500 From: Sven LUTHER Sender: weis@pauillac.inria.fr 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 ? Friendly, Sven Luther