caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Correnson Loïc" <Loic.Correnson@trusted-logic.fr>
To: "Ocaml" <caml-list@inria.fr>
Subject: Re: [Caml-list] Hashtbl and destructive operations on keys
Date: Tue, 23 Mar 2004 10:20:13 +0100	[thread overview]
Message-ID: <00b901c410b8$0c1adb10$0203a8c0@hoedic> (raw)
In-Reply-To: <Pine.LNX.4.58.0403222348530.30579@seekar.cip.physik.uni-muenchen.de>

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


  parent reply	other threads:[~2004-03-23  9:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-22 18:16 Thomas Fischbacher
2004-03-22 19:09 ` Remi Vanicat
2004-03-22 23:13   ` Thomas Fischbacher
2004-03-23  0:59     ` Jacques Garrigue
2004-03-23  9:20     ` Correnson Loïc [this message]
2004-03-23 12:12       ` Thomas Fischbacher
2004-03-23  9:45     ` Oliver Bandel
2004-03-22 23:44 Oliver Bandel
2004-03-22 23:44 Oliver Bandel

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='00b901c410b8$0c1adb10$0203a8c0@hoedic' \
    --to=loic.correnson@trusted-logic.fr \
    --cc=caml-list@inria.fr \
    /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).