Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Does Caml have slow arithmetics ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Luc Maranget <Luc.Maranget@i...>
Subject: Re: [Caml-list] Does Caml have slow arithmetics ?
>  >  + ocamlc does perform tail call elimation
>  >  + ocamlopt does it less often. Namely, calls in tail position
>  >    become real tail calls when all their arguments are passed in register s.
>  >    (This does not apply to self-tail calls which are always optimized)
>  > 
>  > In fact you need 7 arguments or more in the callee to
>  > trigger the unoptimized behavior on a pentium (just checked this time)...
>  > 
>  > Do not take it that bad. In practice, it does not matter much I guess.
> 
> Hmm.  Guess I'm shooting myself in the foot with this code (and lots
> more like it):
> 
> let rec decl r imps exports lbls ks consts types regs archs data d k = match d with
>   | A.DeclAt(x,r)   -> decl r imps exports lbls ks consts types regs archs data x k
>   | A.Typedef d     -> k imps exports lbls ks consts ((r,d) :: types) regs archs data
...
> 
> It's a wee bit depressing---I had hoped to treat a function call as a
> goto while avoiding unbounded stack growth or unnecessary heap
> allocation...

What I  exactely meant was that ``unbounded stack growth or unnecessary heap
allocation'' may not be as bad as it may seem.

Especially as regards heap allocation, provided allocated objects are
short-lived.


--Luc

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