Optimizing delegates

loser noneedtotalkanymore at to.me
Sun Dec 19 15:51:36 PST 2010


Andrei Alexandrescu Wrote:

> On 12/19/10 11:17 AM, Andrei Alexandrescu wrote:
> > Inlining delegates is technically much more difficult than inlining
> > aliases. This is because a different function will be generated for each
> > alias argument, whereas only one function would be used for all
> > delegates. There are techniques to address that in the compiler, but
> > they are rather complex.
> 
> Let me add that good Lisp programmers understand that very well. 
> Seasoned Lisp experts seldom use the textbook lambdas as can be seen in 
> all Lisp books and that rank and file Lisp programmers use everywhere. 
> Experts use macros because they understand their advantages (of which 
> speed is an important one).

It's only complex if you're an incompetent compiler writer. I knew whole the time the main reason was someone's incompetence. You needed two posts to defend W. Poor man.

I can't guess how extensively you've tested modern implementations of functional languages lately, but it's possible that some Lisp implementations don't inline small lambdas in cases like this. In general, passing small lambdas is as common in functional programming as semicolons in D. Would be strange if they didn't optimize them well nowadays.


More information about the Digitalmars-d mailing list