Thread overview
[Issue 18629] std.algorithm.iteration.subsitute is slow
Mar 18, 2018
Basile B.
Mar 19, 2018
greenify
Mar 24, 2018
John Colvin
Mar 24, 2018
John Colvin
Mar 26, 2018
Carsten Blüggel
Dec 17, 2022
Iain Buclaw
March 18, 2018
https://issues.dlang.org/show_bug.cgi?id=18629

Basile B. <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86_64                      |All
                 OS|Linux                       |All
           Severity|enhancement                 |normal

--
March 19, 2018
https://issues.dlang.org/show_bug.cgi?id=18629

greenify <greeenify@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greeenify@gmail.com
           Assignee|nobody@puremagic.com        |greeenify@gmail.com

--
March 24, 2018
https://issues.dlang.org/show_bug.cgi?id=18629

John Colvin <john.loughran.colvin@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.loughran.colvin@gmail.
                   |                            |com

--- Comment #1 from John Colvin <john.loughran.colvin@gmail.com> ---
Created attachment 1684
  --> https://issues.dlang.org/attachment.cgi?id=1684&action=edit
benchmark

--
March 24, 2018
https://issues.dlang.org/show_bug.cgi?id=18629

--- Comment #2 from John Colvin <john.loughran.colvin@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.

--
March 26, 2018
https://issues.dlang.org/show_bug.cgi?id=18629

Carsten Blüggel <chilli@posteo.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chilli@posteo.net

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

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

--