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 KAA01361; Tue, 23 Mar 2004 10:14:54 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 KAA02293 for ; Tue, 23 Mar 2004 10:14:53 +0100 (MET) Received: from mailhost.trusted-logic.fr (mailhost.trusted-logic.fr [194.250.150.5]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i2N9EqHd019196 for ; Tue, 23 Mar 2004 10:14:52 +0100 Received: from wight.trusted-logic.fr (wight.trusted-logic.fr [192.168.1.210]) by mailhost.trusted-logic.fr (Postfix) with ESMTP id CB5642E7 for ; Tue, 23 Mar 2004 10:14:51 +0100 (CET) Received: from hoedic (hoedic.trusted-logic.fr [192.168.3.2]) by wight.trusted-logic.fr (Postfix) with SMTP id B473F713C0 for ; Tue, 23 Mar 2004 10:14:51 +0100 (CET) Message-ID: <00b901c410b8$0c1adb10$0203a8c0@hoedic> From: =?iso-8859-1?Q?Correnson_Lo=EFc?= To: "Ocaml" References: <871xnky9zk.dlv@vanicat.homelinux.org> Subject: Re: [Caml-list] Hashtbl and destructive operations on keys Date: Tue, 23 Mar 2004 10:20:13 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 hashtbl:01 hashtbl:01 hashing:01 reuse:01 ocaml's:01 hashing:01 hash:01 collision:01 fragile:01 hash:01 work-around:01 incompatible:01 exhibit:01 implements:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 323 Hi! Notice also that implementing your own hashtbl would not be so far difficult. For your dedicated use, the code for hashing and replacing this key to that value would not exceed 10 lines, assuming you can reuse Ocaml's hashing function and implements hash collision with a simple array and associative lists. Instead, your *codes* to work around Hashtbl with or without references may never answer your question and will remain actually under specified and fragile for your own purpose. Moreover, it is clear in your case that the capability for ocaml hash tables to register several values for one key is useless, since your always use replace and never add for existing key. To finish with, your work-around code uses 3 times the hashtbl functions, hence you hash the key 3 times. This is incompatible with looking for performance! In my opinion, libraries always provide correct implementation for prototyping or for reference implementation (e.g. for testing purpose). However, ocaml library are always highly performant for normal use, and this is why programming with ocaml is efficient. Then, when facing a very low level performance constraint -- which in my opinon should be exhibit first -- , one must look for a dedicated implementation and not spent time in work arounf existing stuff. LC. ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners