Ranges, Performance, and opApply
Виталий Фадеев
vital.fadeev at gmail.com
Wed Aug 11 12:05:03 UTC 2021
https://forum.dlang.org/post/j8nnr2$bgf$1@digitalmars.com
On Tuesday, 1 November 2011 at 03:08:18 UTC, Kapps wrote:
> Thanks for the explanation guys.
I interest this too.
Theme up.
int opApply( scope int delegate( FT_Outline outline ) dg )
{
// ...more code...
return 0;
}
void main()
{
// ...initialization code...
foreach ( outl; outline )
{
writeln( outl );
}
}
I tested this code in Compiler Explorer:
https://godbolt.org/z/vnqoYsazn
With default options LDC do call the `example.FT_Outline.opApply`.
But with `-O` and when function `opApply()` marked as `pragma(
inline, true )` then LDC put opApply() body inline. I see call
`writeln()` directly from `_Dmain`, without call/ret | jmp.
LDC can put foreach body inline. But need to test with real-world
application.
More information about the Digitalmars-d
mailing list