From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA18030; Fri, 9 Jul 2004 19:54:55 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA17973 for ; Fri, 9 Jul 2004 19:54:54 +0200 (MET DST) Received: from mail.eecs.harvard.edu (bowser.eecs.harvard.edu [140.247.60.24]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i69HsrEV004160 for ; Fri, 9 Jul 2004 19:54:54 +0200 Received: from localhost (localhost.eecs.harvard.edu [127.0.0.1]) by mail.eecs.harvard.edu (Postfix) with ESMTP id 2210454C64B; Fri, 9 Jul 2004 13:54:51 -0400 (EDT) Received: from mail.eecs.harvard.edu ([127.0.0.1]) by localhost (bowser.eecs.harvard.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06022-03; Fri, 9 Jul 2004 13:54:50 -0400 (EDT) Received: from labrador.eecs.harvard.edu (labrador.eecs.harvard.edu [140.247.60.247]) by mail.eecs.harvard.edu (Postfix) with ESMTP id EB0D554C649; Fri, 9 Jul 2004 13:54:50 -0400 (EDT) Received: by labrador.eecs.harvard.edu (Postfix, from userid 32074) id E45F21EB1B9; Fri, 9 Jul 2004 13:54:50 -0400 (EDT) To: ocaml Subject: Re: [Caml-list] Does Caml have slow arithmetics ? In-Reply-To: Message from Luc Maranget of "Thu, 08 Jul 2004 17:49:06 +0200." <20040708174906.B3687@beaune.inria.fr> References: <20040707091308.GA26172@bourg.inria.fr> <20040707145803.GB27498@yquem.inria.fr> <1089227778.29648.81.camel@pelican.wigram> <20040708034455.GB29942@davidb.org> <40ED190E.3080005@ps.uni-sb.de> <20040708140408.GA2386@davidb.org> <20040708163653.A1260@beaune.inria.fr> <40ED6424.7090903@baretta.com> <20040708174906.B3687@beaune.inria.fr> Date: Fri, 09 Jul 2004 13:54:50 -0400 From: Norman Ramsey Message-Id: <20040709175450.E45F21EB1B9@labrador.eecs.harvard.edu> X-Virus-Scanned: by amavisd-new at eecs.harvard.edu X-Miltered: at nez-perce with ID 40EEDBED.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 arithmetics:01 ramsey:01 ocamlc:01 ocamlopt:01 callee:01 unoptimized:01 decl:01 lbls:01 decl:01 lbls:01 const:01 wee:99 avoiding:01 unbounded:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > + 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