From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p6SGU5PC012434 for ; Thu, 28 Jul 2011 18:30:05 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmEDAHeNMU7RVaE2kGdsb2JhbAA0AQEBAQMUAhcbAR8cAgMNBwULDQkiDwkDAgECAQIUEgEFASQVCQYBAR+YLo8DCBQBAQEBCQkNBxQEIYh+pTsKjCuCUoR2O4htAgMGhjsEknmFB4Emhh88g10 X-IronPort-AV: E=Sophos;i="4.67,283,1309730400"; d="scan'208";a="114349454" Received: from mail-fx0-f54.google.com ([209.85.161.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 28 Jul 2011 18:30:00 +0200 Received: by fxe4 with SMTP id 4so2654613fxe.27 for ; Thu, 28 Jul 2011 09:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=SAdAVJmBCaUG14YtEVaN91qJ01QJloNkcXj4OWIpaC0=; b=cEmfByQh7DsZaJHHy/yX3UZvSm4w7suyRSDrIBBPPOrWfCZBKnDg2kYrzG57XgqALZ wKbc2B4oQlXwuTfP1c5MG2uZyH0Ncz7eiy80KzRlFgMORjpq98sIgZc/QnKYoaNw+fJJ rRSjkZ/BBckuxTbIFzU0/rINwZLw83TNo21FM= Received: by 10.223.17.6 with SMTP id q6mr246158faa.96.1311870599945; Thu, 28 Jul 2011 09:29:59 -0700 (PDT) Received: from [192.168.1.64] (94-193-173-247.zone7.bethere.co.uk [94.193.173.247]) by mx.google.com with ESMTPS id a2sm251441fak.1.2011.07.28.09.29.56 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Jul 2011 09:29:58 -0700 (PDT) Message-ID: <4E318E7D.6060802@gmail.com> Date: Thu, 28 Jul 2011 17:29:49 +0100 From: Toby Kelsey User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 To: caml-list@inria.fr References: <4E307DFE.3040502@gmail.com> <4E313071.7090309@inria.fr> <20110728142529.ksntzfow5wo84404@www.recherche.enac.fr> <4E316FA2.7040108@inria.fr> In-Reply-To: <4E316FA2.7040108@inria.fr> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Hashtbl performance On 28/07/11 15:18, Xavier Leroy wrote: > Fabrice Le Fessant : > >> Thus, you should consider using your own hash function, probably only >> considering the ints in the list and its length. Then, use the functor >> in the Hashtbl module. > > On 07/28/2011 02:25 PM, barnier@recherche.enac.fr wrote: > >> You could also use the hash_param : int -> int -> 'a -> int >> function in the functor which allows to specify the number >> of nodes traversed to compute the key : > > Both Fabrice's and Nicolas's suggestions are excellent. > > Let me just add that this problem with lists as hashtable keys is one > of the known issues with OCaml's current generic hash function: the > other is that the mixing functions used are simplistic and exhibit > some statistical bias, even for strings. I will try both suggestions and look at the SVN trunk. Let me just add that the lists being hashed are all of length 5, so the length should not be the issue. Hopefully 3.13 will fix this problem. Thanks everyone for the useful suggestions, Toby