From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA11321; Mon, 5 Nov 2001 11:20:11 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA11416 for ; Mon, 5 Nov 2001 11:20:10 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fA5AJvH00154; Mon, 5 Nov 2001 11:19:57 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA11264; Mon, 5 Nov 2001 11:19:56 +0100 (MET) Date: Mon, 5 Nov 2001 11:19:56 +0100 From: Xavier Leroy To: "Marcin 'Qrczak' Kowalczyk" Cc: caml-list@inria.fr Subject: Re: [Caml-list] Specialized dictionaries Message-ID: <20011105111956.B10535@pauillac.inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from qrczak@knm.org.pl on Mon, Nov 05, 2001 at 10:06:42AM +0000 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I need dictionaries indexed by ints which must be very fast. I'm > afraid that there is an overhead in using Hashtbl.t such that the > generic hash function must recognize that the value is immediate > instead of using it as a hash directly. > > Is it worth to do something with it? What to do? I could copy the first > half of hashtbl.ml and replace all occurrences of the function hash by > land'ing with 0x3FFFFFFF (so the value is nonnegative and mod gives > nonnegative results). Any better idea? No, no need to copy anything, just unleash the power of functors! module IntHashtbl = Hashtbl.make(struct type t = int let equal = (==) let hash x = x land 0x3FFFFFFF end) I'm not sure the performance gain is significant, but it's worth a try. - Xavier Leroy ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr