63 points · by rohunati · 12y ago · 73 comments
They haven't.
AS C++ competitor, it seems logical that D would require more time to mature than a scripting language and even now-successful languages like Python have taken a long period before they gained traction and then popularity.
And Facebook is using it, that seems to imply some reasonable momentum.
Ha! you are fun, searching through my comment history and downvoting old comments still downvotable. Whatever floats your boat.
But yes, instead of acknowledging that there's a valid point there, let's just accuse everyone who lives in the real world where you actually have to USE a language, not just admire its technical merits, of being low and middle brow.
>Lets talk about Justin Bieber!
I don't understand why you invoked the name of a Canadian popstar. There is no chance of such a comment adding to the discussion.
I think D made more sense pre-C++11.
As for, should one abandon and existing C++ project and rewrite in D. Probably a bad idea, such a thing would require strong arguments. On the other hand for some project that is beginning now, I would say its evenly matched. The possibility of abandoning a lot of the C++ cruft and legacy is not something that should be ignored. Whether that compensates for the reduced maturity of tooling as compared to C++ has to be decided on a case by case basis, and this question is going to be a perennial question that would afflict the adoption of any new language. Its hard to have authoritative answers for this. That said I am looking forward to some improvements in D, better garbage collection, better separation of functions in the std library that uses garbage collection, getting the runtime memory requirements down for compiling D code that uses a lot of CTFE, and well if you could add sum types and pattern matching and efficient fibres/coroutines that would be very nice. I think fibres would be a tough one if one has to maintain portability and compatibility with C libraries.
I take any performance claims made by a particular language with a pretty big grain of salt (particularly those made vs Java/JVM) unless they're accompanied by some reasonably sophisticated benchmarks and source that actually show a performance difference -- not just one that low-level language enthusiasts presume exists.
And yes, languages are not slow or fast. The JVM could be as fast or even faster than native (AOT) because JIT can in theory optimize better than AOT. There are fixes planned for performance issues. Things have improved since the benchmark. It's only one particular benchmark. One specific implementation of VM/compilers/etc. Let me show you some badly written code in language X that runs slower than language Y on machine Z.
In my opinion JIT is always going to be slower than native (AOT). Maybe the gap will close but fundamentally you can do anything a JIT does AOT at zero run-time cost but not the other way around. That's not a language thing, C++ targetted at a JIT environment (and I think you can target .NET for example) will also run slower and languages that are JITted today could possibly be AOT.
The other thing is that if a specific language doesn't allow fine control over memory layouts and data types at the native level and/or if there are inherent costs in the language's design (e.g. duck typing) that is also something that will ultimately prevent it from running as fast as languages that do. That's because you can always build higher abstractions from primitive ones but you can rarely build a primitive one from a higher one. Very smart compilers may be able to identify a "primitive use case" and optimize for that but in general that's a much harder problem.
False. Amongst the things that JITs can do that AOTs cannot are optimisation based on profiling of the program executing with its actual inputs, interprocedural optimisation of dynamically linked code, interprocedural optimisation of code generated at runtime, and runtime specialisation [1].
I'm not sure there's a bright line between runtime profile-guided optimisation and runtime specialisation; however, i think most of the optimisation that production JITs do today is more reasonably classed as the former, rather than the latter. However, the other three are all happening right now in JVMs around the world.
[1] http://en.wikipedia.org/wiki/Run-time_algorithm_specialisati...
1. If you want to you can use the same techniques JIT employs in your AOT program. You can basically embed a JIT in your program if you think that's beneficial for some specific scenario.
2. Whatever the JIT comes up with as an optimal solution for some specific run-time scenario, assuming it's really optimal, can be used in an AOT compiled program. I think the reality today is that JITs very rarely come up with an optimal solution anyways but if they did you can still embed that solution in an AOT compiled program so therefore they have no fundamental advantage.
There's no getting away from the fact that as you add more and more layers to the onion you are losing fine control and you are giving up performance. Assembly beats C (disallowing inline assembly) beats JIT (disallowing embedded native code). It could be argued that a human writing assembly can't match what tools can generate but that's not actually really true (given enough time) and even if it is true there's nothing stopping the human from using tools where appropriate.
You can't inline virtual functions, which is the number 1 optimization done by the JVM (as it enables most other advanced optimizations). You can try achieving it with a profile-guided optimizing compiler, but a JIT can adapt its optimizations based on changes in the inputs (which trigger different code paths at different times in the program's lifetime). Also, the JVM inlines virtual calls even for code loaded at runtime.
> The other thing is that if a specific language doesn't allow fine control over memory layouts and data types at the native level...
True. Java 8 already takes steps in that direction with the @Contended annotation (that adds padding to prevent false-sharing), and Java 9 will let you have much more precise control over layout with value types.
On modern multi-processors, performance is also determined by your ability to use scalable (usually lock-free) concurrent data structures, and those are a lot easier to implement and use when you have a good GC.
I've done lots of multi-threaded programming in C++ some of it with lock-free structures. C++11 brings things like async, futures, promises etc. to the table in the standard library and there are also other concurrency libraries and tools (e.g. OpenMP). Can you expand on how GC would make my life easier in general? Surely it depends on the nature of the task you're trying to solve, locks aren't always the bottleneck and there's not always concurrent solutions.
http://www.azulsystems.com/blog/cliff/2010-07-16-tiered-comp...
The Azul JVM has been doing this for some time. The Sun/Oracle/OpenJDK JVM started doing it in JDK 7. I think IBM's J9 JVM has been doing it for some time too. I'm sure Microsoft's CLR VM does it, they're a smart bunch.
Implement FFT using a JIT that over any length of time/samples is faster than FFTW [1] or an h.264 encoder faster than x.264 [2] .
[1] - http://www.fftw.org/
After isolating everything in Java (including ditching the JDBC driver for lower-level SQLite bindings), nothing changed. It was likely JNI overhead, but frankly, that doesn't matter: Java was too slow. No sophisticated benchmarks here — just real-life production code that runs like molasses in the JVM and runs acceptably in C++.
Also, C++11 is not a low-level language anymore. (And I say this as a long-time Lisp and Clojure programmer.)
In addition, some languages have features which cause them to be more difficult to optimize. (See, e.g., the restrict keyword in C99.)
If they have they should really show it to their journalists.
The thing is D initially wanted to be C++ done right and then C++ done better. So with that in mind it has to have a lot of features. I do appreciate a lot that D feels a lot more homogeneous and designed rather than built up with unrelenting accretion the like C++. An aspect that I quite like is that if it is not immediately clear what should be the right way to resolve a design problem (for example name clash between function overloading and specialization) the D tendency is to make it into an error till the right solution/semantics emerges. In C++ sometimes the choice is somewhat arbitrary: here we have k choices lets pick one and go with it even if it has nothing obviously convincing going for it.
I would like to draw your eye towards templates and template metaprogramming. It really feels bolted on C++, and its really tortuous to use. In D however, although it was added much later it gels very nicely with the rest of the languages. Template metaprogramming is nothing special in D. Its just a function like any other except that it and its arguments are evaluated at compile time. (for D developers reading this, please can we have reference counting for CTFE).
So yes you are correct, it has a lot of features, given D's design scope that is hard to avoid, but these features do fit well enough with each other for a practical language to be used in anger, and fit a lot better than its immediate rival C++ / Java.
As someone who worked on a large project in Ada, you'll need to at some point use the OS and its libraries which for Unix is in C. Want to network or get a OS semaphore? C. Many languages support this call to the C library functionality, but it always seems to force a lot of things back into the C way of doing things.
Maybe with a runtime (Java!, or ada tasks) this is abstracted away, but its still there..
relevant: Co-creator of D works at Facebook.
[0] https://en.wikipedia.org/wiki/Limbo_programming_language
Looking at it today, it looks much more modern, but I'm simply not interested. I've drunk the Rust koolaid. :-)
(But it would be interesting to do a compare and contrast with a decently sized project for both D and Rust).
Two companies that love user data are making "languages" for us to write our applications with (Facebook with Hack and React, Google with Dart and Go)
The NSA worked backdoors into RSA encryption. Could the Facebook/Google compilers provide a similar backdoor for them to syphon data?
/tinfoilhat