How does D’s ‘import’ work?
H. S. Teoh
hsteoh at qfbox.info
Mon Jun 19 01:16:07 UTC 2023
On Sun, Jun 18, 2023 at 03:51:14PM -0600, Jonathan M Davis via Digitalmars-d-learn wrote:
> On Sunday, June 18, 2023 2:24:10 PM MDT Cecil Ward via Digitalmars-d-learn
> wrote:
> > I wasn’t intending to use DMD, rather ldc if possible or GDC
> > because of their excellent optimisation, in which DMD seems
> > lacking, is that fair? (Have only briefly looked at dmd+x86 and
> > haven’t given DMD’s back end a fair trial.)
My experience with D for the past decade or so has consistently shown
that executables produced by LDC or GDC generally run about 40% faster
than those produced by DMD. Especially with CPU-intensive computations.
This is just the hard fact.
Of course, for some applications like shell-script replacements (which,
incidentally, D is really good at -- once your script passes the level
of complexity beyond which writing a shell script just becomes
unmanageable), the difference doesn't really matter, and I'd use DMD
just for faster compile times.
The one thing the DMD backend is really good at, is compiling stuff
*really* fast. LDC has been catching up in this department, but
currently DMD still wins the fast compilation time race, by quite a lot.
So it's very useful for fast turnaround when you're coding. But for
release builds, LDC and GDC are your ticket.
> In general, dmd is fantastic for its fast compilation speed. So, it
> works really well for developing whatever software you're working on
> (whereas ldc and gdc are typically going to be slower at compiling).
> And depending on what you're doing, the code is plenty fast. However,
> if you want to maximize the efficiency of your code, then you
> definitely want to be building the binaries that you actually use or
> release with ldc or gdc.
[...]
Yeah, LDC/GDC are really good at producing optimized executables, but
they do take a long time to do it. (Probably 'cos it's a hard problem!)
So for development -- DMD. For final release build -- GDC/LDC.
T
--
If it tastes good, it's probably bad for you.
More information about the Digitalmars-d-learn
mailing list