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
AW: [Caml-list] generic Hashtbl.to_array
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-07-26 (09:46)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: AW: [Caml-list] generic Hashtbl.to_array

On 2006-07-25, at 14:44, Christoph Bauer wrote:

>> let to_array_4 t =
>>    let init = ref None in
>>    begin try Hashtbl.iter (fun k v -> init := Some (k,v);
>> raise Exit) t
> My guess: hashtbl has to loop over the first empty buckets.
> And this eats the cpu cycles.

I guess that's correct, since you're doing your tests with a
100000-sized hash table that contains only one entry. I wouldn't
call that a typical case.

-- Damien