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 SAA20354; Sun, 18 Nov 2001 18:00:15 +0100 (MET) 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 SAA20156 for ; Sun, 18 Nov 2001 18:00:15 +0100 (MET) Received: from mail.mimuw.edu.pl (paf87.warszawa.sdi.tpnet.pl [217.96.225.87]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fAIH09v22217 for ; Sun, 18 Nov 2001 18:00:10 +0100 (MET) Received: (from news@localhost) by mail.mimuw.edu.pl (PLD/8.9.3) id SAA01721 for caml-list@inria.fr; Sun, 18 Nov 2001 18:01:04 +0100 X-Authentication-Warning: qrnik.zagroda: news set sender to Marcin 'Qrczak' Kowalczyk using -f From: "Marcin 'Qrczak' Kowalczyk" Subject: [Caml-list] Re: Hashtbl and max_len Date: Sun, 18 Nov 2001 17:01:00 +0000 (UTC) Organization: Klub Nieszkodliwych =?iso-8859-2?Q?Manjak=F3w?= Message-ID: References: X-Trace: qrnik.zagroda 1006102860 1618 192.168.0.1 (18 Nov 2001 17:01:00 GMT) X-Complaints-To: abuse@localhost NNTP-Posting-Date: Sun, 18 Nov 2001 17:01:00 +0000 (UTC) User-Agent: slrn/0.9.7.2 (Linux) To: caml-list@inria.fr Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Sun, 18 Nov 2001 14:55:17 +0000 (UTC), Marcin 'Qrczak' Kowalczyk pisze: > The initial_size argument of Hashtbl.create has much bigger impact on > efficiency than I thought. The documentation is misleading in saying > that "The table grows as needed, so n is just an initial guess", > thus suggesting that it shouldn't matter much what was given after > the table is filled. Ah, I see that the version in cvs has changed the policy of resizing and it indeed works better when a good initial size is not known. It has a bug though: --- hashtbl.ml~ Sun Nov 18 17:44:57 2001 +++ hashtbl.ml Sun Nov 18 17:57:42 2001 @@ -197,7 +197,7 @@ let bucket = Cons(key, info, h.data.(i)) in h.data.(i) <- bucket; h.size <- succ h.size; - if h.size > Array.length h.data lsl 1 then resize hash h + if h.size > Array.length h.data lsl 1 then resize H.hash h let remove h key = let rec remove_bucket = function @@ -255,7 +255,7 @@ with Not_found -> h.data.(i) <- Cons(key, info, l); h.size <- succ h.size; - if h.size > Array.length h.data lsl 1 then resize hash h + if h.size > Array.length h.data lsl 1 then resize H.hash h let mem h key = let rec mem_in_bucket = function -- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ QRCZAK ------------------- 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