Thread overview
[Issue 14498] Poor codegen optimization for ranges
Apr 25, 2015
weaselcat
Apr 26, 2015
safety0ff.bugz
Dec 17, 2022
Iain Buclaw
April 25, 2015
https://issues.dlang.org/show_bug.cgi?id=14498

weaselcat <r9shackleford@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r9shackleford@gmail.com

--- Comment #1 from weaselcat <r9shackleford@gmail.com> ---
Upon closer inspection, I believe this is an inlining issue, possibly related to cross-module inlining. If I move the function to another file, LDC achieves similar performance as GDC - but it goes away with singleobj flag.

this kills range performance.

coincidentally, on arch linux LDC is the only compiler that doesn't use a statically linked phobos. Maybe related?

--
April 26, 2015
https://issues.dlang.org/show_bug.cgi?id=14498

safety0ff.bugz <safety0ff.bugz@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz@gmail.com

--- Comment #2 from safety0ff.bugz <safety0ff.bugz@gmail.com> ---
(In reply to weaselcat from comment #0)
> using the "slow"(aka ranges) version, DMD produces code that is 4 times
> slower. Almost same exact ratios for GDC, so I assume it's due to frontend(?)
> 
> LDC seems to optimize it away to almost identical performance between "fast" and "slow" version, unsure if it's due to the LLVM optimizations or one of their patches to dmd.
>

AFAIK slow version allocates a closure on the heap, perhaps LDC optimizes out unnecessary closures.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=14498

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--