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 QAA08840; Fri, 9 Jul 2004 16:05:41 +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 QAA08867 for ; Fri, 9 Jul 2004 16:05:40 +0200 (MET DST) Received: from alex.baretta.com ([213.255.109.130]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i69E5cEV012210; Fri, 9 Jul 2004 16:05:39 +0200 Received: from baretta.com (localhost [127.0.0.1]) by alex.baretta.com (Postfix) with ESMTP id C46152D5ADA; Fri, 9 Jul 2004 10:06:34 -0400 (EDT) Message-ID: <40EEA66A.6090900@baretta.com> Date: Fri, 09 Jul 2004 16:06:34 +0200 From: Alex Baretta User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: it, en-us, en MIME-Version: 1.0 To: Luc Maranget , Ocaml Subject: Re: [Caml-list] Does Caml have slow arithmetics ? 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> In-Reply-To: <20040708174906.B3687@beaune.inria.fr> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 40EEA632.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; baretta:01 baretta:01 caml-list:01 arithmetics:01 callee:01 unoptimized:01 tail-call:01 ocamlopt:01 recursion:01 tail-call:01 ocamlopt:01 unexpected:01 ocaml:01 caml:01 byte:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Luc Maranget wrote: > In fact you need 7 arguments or more in the callee to > trigger the unoptimized behavior on a pentium (just checked this time). This is a fair amount of arguments, but still... >>What?! Is this true? This effectively means that I cannot count on >>tail-call elimination in general? > > > Do not take it that bad. In practice, it does not matter much I guess. > > I guess that any ocamlopt back-end passes at least the first six argument in > registers (and six is a lot). > > Besides stack grow is a less severe issue in native code than it is in > byte code. At least in Unix, the process stack may grow to important sizes. The trouble is that I have always considered idiomatically correct the use of tail-recursion in exchange for loops. Often, the main loop of my code is actually a non-terminating recursion. I really think that the lack of full tail-call optimization in ocamlopt is BAD! I feel very strongly about this because it is a completely unexpected behavior in a proper functional language like Ocaml. I'll have to verify that nowhere in my code do I use functions with more than seven arguments. If need be, I'll have to compact the arguments into tuples or records so as to stay within the tail-call optimization limit. Yet, although this is feasible and probably will have a minimal impact on my code, I still believe that ocamlopt should do anything it can to perform proper tail-call optimization all the time. Alex ------------------- 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