From: Yoann Padioleau <padiolea@irisa.fr>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: padiolea@irisa.fr, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] OCaml troll on Slashdot
Date: 16 Mar 2005 15:14:11 +0100 [thread overview]
Message-ID: <m37jk73cgc.fsf@ryxa.irisa.fr> (raw)
In-Reply-To: <20050316.224108.35690658.garrigue@math.nagoya-u.ac.jp>
Jacques Garrigue <garrigue@math.nagoya-u.ac.jp> writes:
> From: Yoann Padioleau <padiolea@irisa.fr>
> > Jon Harrop <jon@ffconsultancy.com> writes:
> > > Although Map is asymptotically faster than List.assoc for lookup (O(ln n) vs
> > > O(n)), OCaml's Hashtbl and array-based equivalents are typically several
> > > times faster than Map.
> >
> > I agree, I beleived that too but
> > I switched from Map to Hashtbl in the "troll" code and Hashtbl sux.
> > I don't know why.
>
> Because the default hash function doesn't work well on complex
> data-structures, where it has lots of collisions, and results in
> putting lots of values in the same bucket. It's a bad idea to directly
> use complex data structures as key anyway, but particularly bad with
> hash tables.
>
> > > In OCaml, non-tail-recursive functions are often faster than their tail
> > > recursive equivalents for small inputs (e.g. short lists).
> >
> > really ? why ?
>
> Because tail-recursive versions do some extra work to ensure
> tail-recursiveness. For instance building a list in reverse order, and
> converting it back with List.rev at the end. This only pays off for
> huge lists.
I am happy. I have learned (or re-learned) a few stuff from this thread
so in a way from this "troll" :)
Perhaps it is not always a waste of time to post in the news :)
It would be cool if some of those insights on optimization would be put
somewhere via a wiki.
http://haskell.org/hawiki/ThingsToAvoid is a good stard but it is for haskell
(but many stuff said still apply to ocaml).
I am sure that I am not the only one to ask for a wiki
(and not the only one to do nothing about it :) )
It seems that this page is no more accessible from the new website
http://caml.inria.fr/pub/old_caml_site/FAQ/FAQ_EXPERT-eng.html#efficacite
>
> Jacques Garrigue
>
--
Yoann Padioleau, INSA de Rennes, France www.irisa.fr/prive/padiolea/
Opinions expressed here are only mine. Je n'écris qu'à titre personnel.
**____ Get Free. Be Smart. Simply use Linux and Free Software. ____**
next prev parent reply other threads:[~2005-03-16 14:14 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-15 1:29 Karl Zilles
2005-03-15 8:32 ` [Caml-list] " Oliver Bandel
2005-03-15 8:45 ` Michael Vanier
2005-03-15 8:59 ` Jon Harrop
2005-03-15 20:17 ` Yoann Padioleau
2005-03-15 20:36 ` Jon Harrop
2005-03-15 21:03 ` padiolea
2005-03-15 21:40 ` William D.Neumann
2005-03-15 22:12 ` Yoann Padioleau
2005-03-15 23:07 ` William D.Neumann
2005-03-15 23:39 ` Jon Harrop
2005-03-15 23:54 ` Thomas Fischbacher
2005-03-16 0:03 ` Christopher Dutchyn
2005-03-16 0:18 ` Oliver Bandel
2005-03-16 1:05 ` Yoann Padioleau
2005-03-16 2:55 ` Oliver Bandel
2005-03-16 11:23 ` Thomas Fischbacher
2005-03-16 23:41 ` Oliver Bandel
2005-03-16 13:33 ` Yoann Padioleau
2005-03-16 23:59 ` Oliver Bandel
2005-03-16 3:01 ` Jon Harrop
2005-03-16 13:10 ` Yoann Padioleau
2005-03-16 13:41 ` Jacques Garrigue
2005-03-16 14:14 ` Yoann Padioleau [this message]
2005-03-17 0:27 ` Oliver Bandel
2005-03-16 17:43 ` brogoff
2005-03-16 19:51 ` Jon Harrop
2005-03-17 3:35 ` brogoff
2005-03-17 3:48 ` Yaron Minsky
2005-03-17 10:16 ` Jon Harrop
2005-03-17 10:47 ` Oliver Bandel
2005-03-17 18:06 ` brogoff
2005-03-17 19:15 ` Marcin 'Qrczak' Kowalczyk
2005-03-18 17:46 ` brogoff
2005-03-18 18:44 ` Marcin 'Qrczak' Kowalczyk
2005-03-17 21:31 ` Oliver Bandel
2005-03-17 9:45 ` Christian Szegedy
2005-03-17 10:31 ` Jon Harrop
2005-03-17 11:11 ` Ville-Pertti Keinonen
2005-03-17 11:31 ` tail-recursion vs. no tail-recursion in list functions sebastian.egner
2005-03-17 21:41 ` [Caml-list] " Oliver Bandel
2005-03-18 0:04 ` David Brown
2005-03-18 0:06 ` Karl Zilles
2005-03-18 1:13 ` Jacques Garrigue
2005-03-17 0:21 ` [Caml-list] OCaml troll on Slashdot Oliver Bandel
2005-03-17 1:05 ` Jacques Garrigue
2005-03-17 17:32 ` Jason Hickey
2005-03-17 19:06 ` Marcin 'Qrczak' Kowalczyk
2005-03-17 0:14 ` Oliver Bandel
2005-03-16 1:38 ` Jacques Garrigue
2005-03-31 11:42 ` Paul Argentoff
2005-03-31 11:41 ` Paul Argentoff
2005-03-15 20:06 ` Yoann Padioleau
2005-03-15 9:25 ` Richard Jones
2005-03-15 10:08 ` YANG Shouxun
2005-03-15 20:02 ` Yoann Padioleau
2005-03-15 22:33 ` Richard Jones
2005-03-16 1:33 ` YANG Shouxun
2005-03-15 10:34 ` padiolea
2005-03-15 10:52 ` Diego Olivier Fernandez Pons
2005-03-15 14:12 ` Eijiro Sumii
2005-03-15 15:25 ` Christophe TROESTLER
2005-03-15 18:05 ` Thomas Fischbacher
2005-03-15 18:26 ` Kip Macy
2005-03-16 0:32 ` Oliver Bandel
2005-03-16 11:26 ` David Fox
2005-03-15 18:55 ` Christopher A. Watford
2005-03-15 19:56 ` Jon Harrop
2005-03-16 0:35 ` Oliver Bandel
2005-03-16 0:34 ` Oliver Bandel
2005-03-18 6:04 Harrison, John R
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=m37jk73cgc.fsf@ryxa.irisa.fr \
--to=padiolea@irisa.fr \
--cc=caml-list@yquem.inria.fr \
--cc=garrigue@math.nagoya-u.ac.jp \
/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