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 NAA23119; Sat, 24 Apr 2004 13:00:06 +0200 (MET DST) 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 NAA22623 for ; Sat, 24 Apr 2004 13:00:05 +0200 (MET DST) Received: from hirsch.in-berlin.de (hirsch.in-berlin.de [192.109.42.6]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3OB04YM014973 for ; Sat, 24 Apr 2004 13:00:04 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from hirsch.in-berlin.de (localhost [127.0.0.1]) by hirsch.in-berlin.de (8.12.11/8.12.11/Debian-3) with ESMTP id i3OB02oA001593 for ; Sat, 24 Apr 2004 13:00:03 +0200 Received: from first.UUCP (uucp@localhost) by hirsch.in-berlin.de (8.12.11/8.12.11/Debian-3) with UUCP id i3OAo1uL000602 for inria.fr!caml-list; Sat, 24 Apr 2004 12:50:01 +0200 Received: by first.in-berlin.de via sendmail from stdin id (Debian Smail3.2.0.114) Sat, 24 Apr 2004 12:39:44 +0200 (CEST) From: oliver@first.in-berlin.de (Oliver Bandel) Date: Sat, 24 Apr 2004 12:39:44 +0200 To: caml-list@inria.fr Subject: Re: [oliver: Re: [Caml-list] Should be INSIDE STANDARD-LIB: Hashtbl.keys] Message-ID: <20040424103944.GF1336@first.in-berlin.de> References: <20040423200923.GA271@first.in-berlin.de> <1082775638.21205.687.camel@pelican.wigram> <200404240546.17082.jdh30@cam.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <200404240546.17082.jdh30@cam.ac.uk> User-Agent: Mutt/1.3.28i 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; oliver:01 in-berlin:01 oliver:01 bandel:01 caml-list:01 hashtbl:01 2004:99 2004:99 bandel:01 hashtbl:01 sux:99 hash:01 incrementing:01 int:01 lib:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, Apr 24, 2004 at 05:46:17AM +0100, Jon Harrop wrote: > On Saturday 24 April 2004 4:00 am, skaller wrote: > > On Sat, 2004-04-24 at 06:09, Oliver Bandel wrote: > > > Because there is no Hashtbl.size in the standard lib, > > > > which sux because O(n) is a high price to pay > > for an integer the Hashtbl could keep track of > > easily. > > I don't want the overhead of hash tables carrying around and updating an int. > I was miffed when they put an O(1) criterion on length() in the STL "list" in > C++... > OK, if it is too much performance critical, then forget the idea with the counter. So Hashtbl.size should be done with Hashtbl.iter and incrementing a counter-ref then. But maybe it nevertheless makes sense to put it inside the Hashtbl-module. (But not necissarily.) Ciao, Oliver ------------------- 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