caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@maxtal.com.au>
To: Stephan Houben <stephan@pcrm.win.tue.nl>
Cc: caml-list@inria.fr
Subject: Re: symbol managment in Caml
Date: Sat, 26 Feb 2000 03:21:26 +1100	[thread overview]
Message-ID: <38B6AC06.691D5673@maxtal.com.au> (raw)
In-Reply-To: <20000225131622.A4595@pcrm.win.tue.nl>

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?

No, but may I suggest using a hashtable of references to strings?
The compiler will also need to keep a separate set of strings,
which the hash table entries reference. I'd be interested in a
performance
comparison (since I have a similar interpreter :-)

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net



  reply	other threads:[~2000-02-25 17:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-25 12:16 Stephan Houben
2000-02-25 16:21 ` skaller [this message]
2000-02-25 16:25 ` Judicael Courant
2000-02-25 17:10 ` Claudio Sacerdoti Coen
2000-02-26  6:13   ` Frank A. Christoph
2000-02-28  9:49 ` Sven LUTHER

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38B6AC06.691D5673@maxtal.com.au \
    --to=skaller@maxtal.com.au \
    --cc=caml-list@inria.fr \
    --cc=stephan@pcrm.win.tue.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).