digitalmars.D - Ranges, Performance, and opApply
- =?UTF-8?B?0JLQuNGC0LDQu9C40Lkg0KTQsNC0?= =?UTF-8?B?0LXQtdCy?= (25/26) Aug 11 2021 I interest this too.
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.
Aug 11 2021