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
Hashtbls with physical equality?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-11-15 (02:20)
From: Wheeler Ruml <ruml@p...>
Subject: Re: [Caml-list] Hashtbls with physical equality?
> > Is it possible in OCaml to have a hash table that can insert and retrieve
> > values without walking over their structure?
> How about something like this?
> module PhysrefHashtbl =
>   Hashtbl.Make (struct type t = string
>     let equal = (==)
>     let hash = Hashtbl.hash
>   end)

My only concern about this solution is that Hashtbl.hash will walk over the
key's structure in order to compute its hash value.  I know that its
computation is bounded, but I'd still love to find something faster and
more more direct if possible.


Wheeler Ruml, Palo Alto Research Center, Rm 1522, 650-812-4329 voice
ruml@parc.com, http://www.parc.com/ruml           650-812-4334 fax