On 1/8/2012 6:28 PM, Mehrdad wrote:
On 1/7/2012 10:57 PM, Jonathan M Davis wrote:
Not exactly the most informed discussion.

Well, some of their comments _ARE_ spot-on correct...

2. "While you can avoid the garbage collector, that basically means you
can't use most of the standard library."
Looks pretty darn correct to me -- from the fixed-size array literal
issue (literals are on the GC heap), to all the string operations (very
little is usable), to associative arrays (heck, they're even part of the
language, but you can't use them without a GC), etc...

As someone who does performance-critical scientific work in D, this comment is absolutely **wrong** because you only need to avoid the GC in the most performance-critical/realtime parts of your code, i.e. where you should be avoiding any dynamic allocation, GC or not. (Though GC is admittedly worse than malloc, at least given D's current quality of implementation.)

My style of programming in D is to consciously transition between high-level D and low-level D depending on what I'm doing. Low-level D avoids the GC, heavy use of std.range/std.algorithm since the compiler doesn't optimize these well yet, and basically anything else where the cost isn't clear. It's a PITA to program in like all low-level languages, but not as bad as C or C++. Nonetheless low-level D is just as fast as C or C++. High-level D is slower than C or C++ but faster than Python, and integrates much more cleanly with low-level D than Python does with C and C++. It's only slightly harder to program in than Python.

Bottom line: D doesn't give you a free lunch but it does give you a cheaper lunch than C, C++ or even a combination of C/C++ and Python.

Reply via email to