From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id DC073BC0A for ; Fri, 19 Jan 2007 00:57:58 +0100 (CET) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.246]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0INvw8j000360 for ; Fri, 19 Jan 2007 00:57:58 +0100 Received: by an-out-0708.google.com with SMTP id d26so218614and for ; Thu, 18 Jan 2007 15:57:57 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=bjg4YRDYd3x9qjkmnPXQAFoq3xyGiU68JpTuv334mVyHdG0uP3/1YLwi5lG2P5MfbErL5CNoUTPDoV1l+PeBBLeKht4TEw6eK7mNfeyWWzXg5ZV9H29cGmwO1vcGiu8nyXLT/c6d9cp9C+t2mS0kb/mcMgxWhRARumSkLSJEWhQ= Received: by 10.78.185.15 with SMTP id i15mr1592394huf.1169164676593; Thu, 18 Jan 2007 15:57:56 -0800 (PST) Received: by 10.78.198.14 with HTTP; Thu, 18 Jan 2007 15:57:56 -0800 (PST) Message-ID: Date: Thu, 18 Jan 2007 15:57:56 -0800 From: "Nathaniel Gray" To: "Jonathan Roewen" Subject: Re: [Caml-list] Benchmarking different dispatch types Cc: "Edgar Friendly" , "Caml List" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <45AED8C8.3080808@gmail.com> X-j-chkmail-Score: MSGID : 45B00986.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45B00986.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; cheers:01 invoke:01 closures:01 closures:01 wrote:01 caml-list:01 functions:01 closure:01 closure:01 objects:02 objects:02 types:03 dispatch:03 passing:04 comparison:04 On 1/17/07, Jonathan Roewen wrote: > From what I understand, anything other than a function is bound to be > fairly slow in comparison. Sure, but I'm really interested in understanding the "penalty" for using objects instead of, say, closures, and how much (if anything) you get back by turning a method into a closure (as I did with the obj. closure test). It looks like there isn't much penalty, which makes objects much more attractive to me for certain applications, and there's not much gain to be had by "closurizing" method calls. > For closures, you first have to build the closure from the > environment, and then invoke it; and methods require some sort of > lookup. Functions, on the other hand, are fairly simply: it's just a > call to a known address (putting aside passing the actual arguments to > the function/method call). Well, for closures you don't need to build the closure at call-time, that happens when it is created. Cheers, -n8 -- >>>-- Nathaniel Gray -- Caltech Computer Science ------> >>>-- Mojave Project -- http://mojave.cs.caltech.edu -->