caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Goerzen <jgoerzen@complete.org>
To: Oliver Bandel <oliver@first.in-berlin.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Should be INSIDE STANDARD-LIB: Hashtbl.keys
Date: Fri, 23 Apr 2004 15:41:49 -0500	[thread overview]
Message-ID: <20040423204149.GA6485@excelhustler.com> (raw)
In-Reply-To: <20040423191010.GB1506@first.in-berlin.de>

On Fri, Apr 23, 2004 at 09:10:11PM +0200, Oliver Bandel wrote:
> On Fri, Apr 23, 2004 at 01:29:06PM -0500, John Goerzen wrote:
> > On Fri, Apr 23, 2004 at 02:51:41PM +0200, Xavier Leroy wrote:
> > > With your specification (no repetitions in the list), that function
> > > would run in quadratic time, which is a sure sign that lists aren't
> > > the right data structure here.  (More generally speaking, "lists
> > > without repetitions" is almost always the wrong data structure.)
> > 
> > But perhaps you don't really care how fast it runs, since your entire
> > program consumes about 1/10 of a CPU second anyway?
> 
> Depends on number of keys...
> 
> n ^ 2  is less when n is low,
> n = 10 and n = 10000 seems not to matter much...
> but 10^2 and 10000^2 are a differrence that matters a lot!

OK, but why should we eliminate a useful function because 1% of uses
of it will be slow?

Make a note in the docs (like that notes that are there already that say
"this function is not tail-recursive") and put it in for those that will
find it useful.

On another note, I really don't understand why hashtables permit
duplicate keys anyway; it just doesn't seem useful to me.  All my
Hashtbl code uses Hashtbl.replace....

-- John

-------------------
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


  parent reply	other threads:[~2004-04-23 20:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-21  1:19 Oliver Bandel
2004-04-21  8:39 ` Richard Jones
2004-04-21  9:13 ` Martin Jambon
2004-04-23 12:51 ` Xavier Leroy
2004-04-23 13:05   ` Jean-Baptiste Rouquier
2004-04-23 16:04     ` Xavier Leroy
2004-04-23 18:21       ` Jon Harrop
2004-04-23 21:31         ` Jon Harrop
2004-04-23 21:53           ` John Goerzen
2004-04-26  6:28           ` Florian Hars
2004-04-23 18:29       ` John Goerzen
     [not found]         ` <20040423190710.GA1506@first.in-berlin.de>
2004-04-23 20:42           ` John Goerzen
2004-04-23 15:03   ` Richard Jones
2004-04-24  1:58     ` skaller
2004-04-24  9:20       ` Nicolas Cannasse
2004-04-24 19:26         ` skaller
2004-04-26  7:29       ` Jean-Christophe Filliatre
2004-04-23 16:06   ` Brian Hurt
2004-04-23 16:31     ` Martin Jambon
2004-04-23 17:27     ` Christoph Bauer
2004-04-23 18:29   ` John Goerzen
     [not found]     ` <20040423191010.GB1506@first.in-berlin.de>
2004-04-23 20:41       ` John Goerzen [this message]
     [not found]         ` <20040424080904.GA821@first.in-berlin.de>
2004-04-24 20:59           ` John Goerzen
2004-04-25  8:12             ` Oliver Bandel
2004-04-23 18:28 ` John Goerzen

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=20040423204149.GA6485@excelhustler.com \
    --to=jgoerzen@complete.org \
    --cc=caml-list@inria.fr \
    --cc=oliver@first.in-berlin.de \
    /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).