caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
To: caml-list@inria.fr
Subject: [Caml-list] Re: Hashtbl and max_len
Date: Sun, 18 Nov 2001 17:01:00 +0000 (UTC)	[thread overview]
Message-ID: <slrn9vfqac.1ih.qrczak@qrnik.zagroda> (raw)
In-Reply-To: <slrn9vfiul.rkm.qrczak@qrnik.zagroda>

Sun, 18 Nov 2001 14:55:17 +0000 (UTC), Marcin 'Qrczak' Kowalczyk <qrczak@knm.org.pl> 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


  reply	other threads:[~2001-11-18 17:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-18 14:55 [Caml-list] " Marcin 'Qrczak' Kowalczyk
2001-11-18 17:01 ` Marcin 'Qrczak' Kowalczyk [this message]
2001-11-18 17:19   ` [Caml-list] " Marcin 'Qrczak' Kowalczyk
2001-11-19 15:34 ` [Caml-list] " Xavier Leroy

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=slrn9vfqac.1ih.qrczak@qrnik.zagroda \
    --to=qrczak@knm.org.pl \
    --cc=caml-list@inria.fr \
    /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).