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 AAA13974 for caml-redistribution@pauillac.inria.fr; Tue, 29 Feb 2000 00:10:27 +0100 (MET) Resent-Message-Id: <200002282310.AAA13974@pauillac.inria.fr> 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 KAA01451 for ; Mon, 28 Feb 2000 10:45:58 +0100 (MET) Received: from dpt-info.u-strasbg.fr (dpt-info.u-strasbg.fr [130.79.6.1]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id KAA24102 for ; Mon, 28 Feb 2000 10:45:57 +0100 (MET) Received: from lambda.u-strasbg.fr (lambda.u-strasbg.fr [130.79.75.49]) by dpt-info.u-strasbg.fr (8.9.3/8.9.3) with ESMTP id KAA30988 for ; Mon, 28 Feb 2000 10:45:57 +0100 Received: from luther by lambda.u-strasbg.fr with local (Exim 3.12 #1 (Debian)) id 12PMni-0003ft-00 for ; Mon, 28 Feb 2000 10:49:14 +0100 Date: Mon, 28 Feb 2000 10:49:13 +0100 From: Sven LUTHER To: caml-list@inria.fr Subject: Re: symbol managment in Caml Message-ID: <20000228104912.A14111@dpt-info.u-strasbg.fr> Reply-To: luther@dpt-info.u-strasbg.fr Mail-Followup-To: caml-list@inria.fr References: <20000225131622.A4595@pcrm.win.tue.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.0.1i In-Reply-To: <20000225131622.A4595@pcrm.win.tue.nl>; from stephan@pcrm.win.tue.nl on Fri, Feb 25, 2000 at 01:16:22PM +0100 Resent-From: weis@pauillac.inria.fr Resent-Date: Tue, 29 Feb 2000 00:10:27 +0100 Resent-To: caml-redistribution@pauillac.inria.fr On Fri, Feb 25, 2000 at 01:16:22PM +0100, Stephan Houben wrote: > Hello list, > > I am writing an interpreter for a simple language in O'Caml. > The interpreter often needs to search a hash table with a string > as key. A common optimization for this is to use pointer identity > instead of string equality, and "intern" every string before using > it as a key to the hash table. > > Unfortunately, I don't see how to do this with the current O'Caml > libs. You can do identity checks with ==, but there seems no way > to get a good hash corresponding to ==. > > Has anyone already written some code for this task? Be carefull about this, i had the same kind of idea, but found out that using references in ocaml is not necessarily a good way of increasing speed, since some kind of references operation are expensive, and can even trigger a minor garbage collection wich can in turn start a major garbage collection, thus making it very expensive. i was using a small associative list (~15 entries) and it resulted that it was faster than the reference using version. Friendly, Sven LUTHER