Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] looping recursion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] looping recursion
> > Lemme try it out (10^6 elements):
> >
> > ocamlc:
> > rev rev_map version:
> >  2 WALL ( 1.19 usr +  0.02 sys =  1.21 CPU)
> > vanilla map:
> >  7 WALL ( 6.50 usr +  0.09 sys =  6.59 CPU)
> >
> > ocamlopt:
> > rev rev_map version:
> >  1 WALL ( 0.81 usr +  0.03 sys =  0.84 CPU)
> > vanilla map:
> >  2 WALL ( 2.45 usr +  0.02 sys =  2.47 CPU)
>
> OK, so why is List.map in the OCaml standard library implemented the
> vanilla way rather than the rev rev_map way?  If it's such a big win,
> it seems foolish to have a broken implementation for such a crucial
> function.
>
> (BTW, if you want efficient (and pure) mapping and filtering over long
> streams, you should consider using lazy lists.  A good compiler (like
> GHC) will do the deforestation optimisation, so the list is never even
> allocated[1].)
>
> [1] unless you make use of persistence, of course.
>
> --KW 8-)

I think in this thread both "problems" are resolved by ExtLib :
- a fully tail-recursive List module
- Enums for lazy lists

http://ocaml-lib.sf.net

So of course you can still get the pro and cons of having ExtLib
implementation being the standard one, but anyone actually have the choice,
that's important. The choice is up to OCaml INRIA team, and I don't think
any thread - as long and flammy as it could be - would change their
opinions.

Regards,
Nicolas Cannasse

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