D on quora ...
Ola Fosheim Grøstad
ola.fosheim.grostad+dlang at gmail.com
Wed Oct 11 08:25:02 UTC 2017
On Saturday, 7 October 2017 at 15:12:08 UTC, Random D user wrote:
> Actually, Manual Memory Management is slow and D's GC is slower.
Well, no, deterministic memory management isn't slow. One
specific implementation with a high level of naiveté might be
slow.
C is not a very clever language, it was designed to be minimal
and with minimal compiler requirements and with most features
pushed onto libraries, including memory management. C++ is just
meta-level dressing over C…
> Because, if malloc/free is slow (free is often slower), you
> want to avoid them as much as possible.
A naive generic library implementation that is used randomly will
not be fast, but a more dedicated implementation for the program
at hand could be very performant.
> You do this by reusing your memory/buffers.
Yes, in C/C++ you either have to resort to creating your own
allocator in your program or you could used dedicated allocators.
Or you just make them static global.
Anyway, D doesn't improve on C/C++ when it comes to allocators.
And it's garbage collector is pretty much stuck in the standard
GC implementation from 1960s/1970s in terms of performance and
features.
Just because C/C++ is primitive doesn't mean that D is doing
well, but at this point there is not much hope of D becoming a
significant improvement on C++… So maybe it is better for D to
stay where it is as there is basically very little support among
the designers from improving the language semantics. In the C++
environment there is at least some movement, so maybe it will
become a decent language in 2050, although they are stuck with
the primitive C-foundation…
More information about the Digitalmars-d
mailing list