Browse thread
[Caml-list] yet another benchmark: List.map vs tail recursive map
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Alexander V. Voinov <avv@q...> |
| Subject: | Re: [Caml-list] Re: yet another benchmark: List.map vs tail recursive map |
Hi Stefano, Stefano Zacchiroli wrote: >On Wed, Jun 04, 2003 at 05:13:27PM +0200, Christophe TROESTLER wrote: > > >>Given this, it rather seems that List.map is fine -- for if one really >>wants speed, one will compile to native code and the bytecode version >> >> > >My point is not having speed, but rather having tail recursion. In many >cases lists are the correct data structure even for "a lot of elements". > >I've always thought that tail recursive version of map would have been >terribly slower than not tail recrusive one due to the additional >reversal. > A year ago I 'benchmarked' almost exactly the alternatives you discuss within some real application. The difference was substantial, and I had to work with 'lots of elements'. List.rev took significant time, you can't neglect this. I even thought about implementing List.map as a C extension which calls the first argument as a callback and use pointer operations to build the list without consuming the stack. Not sure if it's a _proper-way-to-go_ :-). Alexander ------------------- 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