Lazy eval -- an example issue

kris foo at bar.com
Thu Aug 24 08:07:52 PDT 2006


Paolo Invernizzi wrote:
> kris wrote:
> 
>>> On Wed, 23 Aug 2006 00:33:08 -0700, Paolo Invernizzi  
>>> <arathorn at NOSPAM_fastwebnet.it> wrote:
>>> can you post us the performance difference you  have noticed using 
>>> the char[] version versus the delegate version?
>>
>>
>> As for performance differences, I suspect you're missing the bigger 
>> picture, Paolo?
> 
> 
> I've followed the discussion.
> 
> While I agree that ambiguities must be avoided if possible, and that 
> compiler-made decision are sometimes frustrating (but we all are happy 
> about class-all-virtual-methods!), I was just curious of the performance 
> impact of such a change...


That's simple ~ time a trivial function by calling it several million 
times. Now add a malloc(40) or thereabouts to the same function and time 
it again. There's your performance hit. Note that multithreaded apps 
will run afoul of mutex-contention also.

As for virtual methods; you can choose which are virtual and which are 
not. Seriously though, virtual methods do not allocate from the heap 
when they are called. Imagine if they did ...



More information about the Digitalmars-d mailing list