Thread overview
[Issue 17577] 20%+ Performance degradation in std.conv.to due to 'import std.getopt'
Jun 30, 2017
Vladimir Panteleev
Jun 30, 2017
Jon Degenhardt
Jun 30, 2017
Jon Degenhardt
Jun 30, 2017
Jon Degenhardt
Jun 30, 2017
Vladimir Panteleev
Jun 30, 2017
Jon Degenhardt
Jun 30, 2017
ZombineDev
Dec 02
berni44
June 30, 2017
https://issues.dlang.org/show_bug.cgi?id=17577

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlang-bugzilla@thecybershad
                   |                            |ow.net

--- Comment #1 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
Reproducible on Linux x86_64 (11.6 / 10.6 seconds with dmd)

(In reply to Jon Degenhardt from comment #0)
> Implication so far is that
> something is interfering with proper inlining.
> [...]
>   $ ldc2 -release -O3 -boundscheck=off -singleobj use_conv_to.d
>   $ dmd -release -O -boundscheck=off use_conv_to.d

This command line does not include -inline.

--
June 30, 2017
https://issues.dlang.org/show_bug.cgi?id=17577

--- Comment #2 from Jon Degenhardt <jrdemail2000-dlang@yahoo.com> ---
(In reply to Vladimir Panteleev from comment #1)
> Reproducible on Linux x86_64 (11.6 / 10.6 seconds with dmd)
> 
> (In reply to Jon Degenhardt from comment #0)
> > Implication so far is that
> > something is interfering with proper inlining.
> > [...]
> >   $ ldc2 -release -O3 -boundscheck=off -singleobj use_conv_to.d
> >   $ dmd -release -O -boundscheck=off use_conv_to.d
> 
> This command line does not include -inline.

Nice catch. I'll add -inline to the DMD command lines and retry. (It doesn't apply to the LDC command line.) Thanks!

--
June 30, 2017
https://issues.dlang.org/show_bug.cgi?id=17577

--- Comment #3 from Jon Degenhardt <jrdemail2000-dlang@yahoo.com> ---
Properly adding -inline to the DMD compiler line eliminates the degradation in the DMD builds, at least in 2.075.0-b1. (I deleted 2.074 when updating to beta-1.)

The updated table:

|                | Without       | With          |
| Compiler       | getopt import | getopt import |
|----------------+---------------+---------------|
| DMD 2.075.0-b1 |          5.00 |          4.98 |
| LDC 1.2        |          4.27 |          6.06 |
| LDC 1.3        |          3.61 |          4.63 |

--
June 30, 2017
https://issues.dlang.org/show_bug.cgi?id=17577

Jon Degenhardt <jrdemail2000-dlang@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from Jon Degenhardt <jrdemail2000-dlang@yahoo.com> ---
Likely an LDC issue, so closing in favor of the LDC issue: https://github.com/ldc-developers/ldc/issues/2168. Can be re-opened if this turns out to be incorrect.

--
June 30, 2017
https://issues.dlang.org/show_bug.cgi?id=17577

--- Comment #5 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
But... it's reproducible with DMD...

--
June 30, 2017
https://issues.dlang.org/show_bug.cgi?id=17577

Jon Degenhardt <jrdemail2000-dlang@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #6 from Jon Degenhardt <jrdemail2000-dlang@yahoo.com> ---
Re-opened, as suggested. It is reproducible in DMD. Also, code structure in Phobos could be a contributing factor.

--
June 30, 2017
https://issues.dlang.org/show_bug.cgi?id=17577

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |petar.p.kirov@gmail.com

--
December 02
https://issues.dlang.org/show_bug.cgi?id=17577

berni44 <bugzilla@d-ecke.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |bugzilla@d-ecke.de
         Resolution|---                         |WORKSFORME

--- Comment #7 from berni44 <bugzilla@d-ecke.de> ---
Seems to be fixed meanwhile.

Current dmd (v2.089.0-rc.1-243-g4431f198d) produced 6.26 (without) vs. 6.25
(with) and ldc2 (1.12.0) 4.32 (without) vs 4.26 (with).

--