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: Norman Ramsey <nr@e...>
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
  | A.Import (t,ii) -> k ((r,t,ii)::imps) exports lbls ks consts types regs archs data
  | A.Export (t,ee) -> k imps ((r,t,ee)::exports) lbls ks consts types regs archs data
  | A.Const d       -> k imps exports lbls ks ((r,d) :: consts)  types regs archs data
  | A.Registers rs  -> k imps exports lbls ks consts types ((r, rs) :: regs) archs data
  | A.Target    t   -> k imps exports lbls ks consts types regs ((r, t) :: archs) data
  | A.Pragma        -> k imps exports lbls ks consts 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...


Norman

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