Browse thread
[Caml-list] Hashtbl and max_len
-
Marcin 'Qrczak' Kowalczyk
- Marcin 'Qrczak' Kowalczyk
- Xavier Leroy
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Marcin 'Qrczak' Kowalczyk <qrczak@k...> |
| Subject: | [Caml-list] Re: Hashtbl and max_len |
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