Delegate Literals + Immutability, pure and closures

Steven Schveighoffer schveiguy at yahoo.com
Thu Sep 29 14:13:02 PDT 2011


On Thu, 29 Sep 2011 17:03:26 -0400, dsimcha <dsimcha at yahoo.com> wrote:

> == Quote from Steven Schveighoffer (schveiguy at yahoo.com)'s article
>
>> Also note that next to memory allocation, lack of inlining is the  
>> biggest
>> performance problem.  It's not negligible (in case that is what you were
>> saying, hard to tell from all the negatives ;)
>
> Clarification:  I didn't mean lack of inlining is negligible in general,  
> only for
> this use case.  If you have a bunch of complicated conditions and  
> whatnot in the
> function body then the extra 5 clock cycles or so for a function call  
> probably
> don't mean much

It's more of a gut feeling/anecdotal evidence that I have about inlining.   
I've seen inlining cut the runtime of a function significantly.

A good example, for my std.stdio rewrite, there's one point where I'm  
converting char/wchar to dchar, then to the appropriate width.  At first,  
I just copied the current std.stdio's policy of:

foreach(dchar d; str)

Which is never inlined since it calls an opApply-style runtime function.

but then I added an option to do this inline.  Probably cut the execution  
time by 40% or more.

-Steve


More information about the Digitalmars-d mailing list