Michel Fortin wrote:
On 2009-04-27 00:50:23 -0400, dsimcha <dsim...@yahoo.com> said:

Output:
Direct:  2343
Virtual:  5695
opApply:  3014

Nice.

Isn't there room for optimisation on the compiler side though? I mean, the compiler could inline opApply, and while doing so it could notice that the delegate is constant and inline it too.

For non-virtual opApply this is exactly what LDC does[1] at the higher optimization levels :).
(Assuming both opApply and the foreach body are deemed inline-worthy by the 
inliner)

[1]: Since trunk r1219, which was about 11 days ago.


> I suspect that adding
> this optimisation would put opApply at the same performance level than
> ranges.

I haven't actually measured to see if this is true, but there should indeed be very little difference since this optimization essentially turns opApply into a regular loop (and LDC does this before any loop optimizations run).

Reply via email to