We should deprecate -release

H. S. Teoh hsteoh at qfbox.info
Wed Jul 17 21:19:31 UTC 2024


On Wed, Jul 17, 2024 at 08:25:31PM +0000, Mike Shah via Digitalmars-d wrote:
> On Wednesday, 17 July 2024 at 19:21:02 UTC, Timon Gehr wrote:
> > On 7/17/24 21:12, Mike Shah wrote:
> > > In D Release Candidate to the public: "dmd -O -release -inline
> > > -boundscheck=0ff ..."
> > 
> > Well, this is the one with potential buffer overrun exploits, so not
> > really fit for consumption by the public.
> 
> The description of 'fastest performance' is precise though 🙂 (and
> what you'd want for a benchmark if measuring maximum possible
> performance even when trading safety).
> 
> This is why we probably need some wiki page on best practices for
> builds -- I'll put in my work queue to make a video to explain
> compiler flags in the next few weeks then regardless to help with some
> efforts.

Seriously, if you guys wanna be serious about -release actually doing
something useful, make it run `ldc -O2`.  I'm dead serious.  IME no
amount of -release, -inline, -O with dmd gives me anywhere near
satisfactory performance.  If any of my coworkers were to use dmd and
try to benchmark it with -release, they'd laugh D out of the room.  Make
it run `ldc -O2`, however, and you might actually raise a few eyebrows.

I know it's not nice to admit that dmd does not generate optimal
executables.  I wish I could say otherwise, but the facts are the facts.
I've consistently gotten 30% performance boosts in my program just by
compiling with ldc2 instead of dmd (not even with -O2, just plain ldc2
is enough to give you a significant boost). With ldc2 -O2, I get about
40% performance boost, sometimes up to 50% depending on what the program
does.  If you're trying to win benchmarks, having people use dmd is the
sure way NOT to win them.  You want them to use ldc2, period. You do NOT
want them to use dmd, except when you're trying to compete in the
compile-speed category.

Say what you may about Adam Ruppe and his fork, but he got this one
thing right: have normal dev builds use dmd for compile speeds, and
-release drop dmd altogether and compile with ldc2 instead. This is what
will give newcomers and benchmarkers the best impression of D.

Trying to hack dmd -release to do this or not do that, all of that is
futile, wasted effort. Just ship ldc2 with dmd by default, and have dmd
-release redirect itself to ldc2.  End of story.

(If you don't believe any of the above, don't take my word for it, test
it for yourself. Take any benchmark you wish, compile it with dmd
-release, or dmd -release -O -inline, or any combination of flags you
wish in dmd, really. Run it and save the results.  Now recompile it with
ldc2 -O2.  Compare the results.  The facts speak for themselves.)


T

-- 
Famous last words: I *think* this will work...


More information about the Digitalmars-d mailing list