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 EAA21128; Tue, 10 Dec 2002 04:31:02 +0100 (MET) 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 EAA20931 for ; Tue, 10 Dec 2002 04:31:01 +0100 (MET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id gBA3Ux115750 for ; Tue, 10 Dec 2002 04:31:00 +0100 (MET) Received: from localhost (suiren.kurims.kyoto-u.ac.jp [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.9.3/3.7W) with ESMTP id MAA03816; Tue, 10 Dec 2002 12:30:53 +0900 (JST) To: oleg_inconnu@myrealbox.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] labels overhead In-Reply-To: <200212092209.31850.oleg_inconnu@myrealbox.com> References: <200212092209.31850.oleg_inconnu@myrealbox.com> X-Mailer: Mew version 1.94.2 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20021210123051P.garrigue@kurims.kyoto-u.ac.jp> Date: Tue, 10 Dec 2002 12:30:51 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: Oleg > In his book Paradigms of AI Programming, P. Norvig mentions that Lisp > functions with keyword arguments [1] suffer a large degree of overhead and > that this may also be true for optional and rest arguments, although to a > lesser degree [2], depending on the platform [3]. > > I'm wondering if the same is true for O'Caml. I'm guessing that it's not, > since complete function applications using labels can be transformed into > "normal" function calls at compile time. Am I right? You are right. There is no overhead for non-optional labels in complete applications. The overhead for partial applications is basically the same as doing it by hand, so you cannot say that it is really related to labels. There is an overhead for optional arguments: they are just encoded as (Some arg) if present and (None) if absent, and the decoding is dynamic. This shouldn't be a problem in practive: except when wrapping very simple arithmetic operations, the overhead is neglectible with respect to the cost of the function itself. In both cases, typing allows us to be much more efficient than Common Lisp. --------------------------------------------------------------------------- Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp JG ------------------- 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