Version française
Home     About     Download     Resources     Contact us    
Browse thread
Benchmarking different dispatch types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nathaniel Gray <n8gray@g...>
Subject: Re: [Caml-list] Benchmarking different dispatch types
On 1/17/07, Jonathan Roewen <jonathan.roewen@gmail.com> 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 -->