[Issue 18629] std.algorithm.iteration.subsitute is slow

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 24 17:04:28 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18629

--- Comment #2 from John Colvin <john.loughran.colvin at gmail.com> ---
If you compile with LDC and full optimisations (substitute isn't in LDC's
phobos, see attached file for a working example) then the disparity goes away
(without bounds checking v3 is even faster). This is normal for range-based
code, dmd isn't good at optimising it.

Except that's not the end of the story. If you append extra nonsense to the end
of the input string (-version=LongerString in the attached file)then the
substitute version gets a lot slower again, so perhaps substitute really is
doing something slow and stupid.

--


More information about the Digitalmars-d-bugs mailing list