Hacker News new | ask | show | jobs
by prakis 1054 days ago
I used D for a small prototype. I wrote that same program in GO, C# and Java(native compiled with GraalVM).

The CPU and RAM usage of D-lang out performed all other languages.

Compiled binary size:

D-Lang : 450KB Go : 2 MB C#(.NET) : 8 MB Java-GraalVM: 9 MB

D-Lang CPU & RAM Usage is also less than GO. Unfortunately D-Lang is not popular, not many libraries available.

2 comments

Now compare D app binary sizes with those of C and Free Pascal, and then with Zig, Odin, etc.

Java and C# are not really systems programming languages; they carry too much baggage for that.

Even Go is not too comparable to D

C# and Java have a large base. If you write a small application with it the size will be huge because they both link in the base in the application. It becomes more interesting with larger applications.
Not necessarily anymore now that .NET has had a lot of enhancements for compiling to native and stripping unused references.
I think a lot of people who write off C# don't realise how much it has advanced particularly in the last few years.
C# is getting that sweet spot of how a modern version of Modula-3 should look like.

I also expect the same for Java, if Valhala ever makes it.

So even though Remedy Games had some experience with D, it is C# that gets all the attention as C++ alternative in tooling and graphics engine scripting, while everything that isn't performance critical in Android (no GC at all), gets written in Java/Kotlin.

These are two good examples of how D lost a potencial market, by always re-inventing itself for the next wave of developers that will finally get D and leave everything behind to adopt it, instead of focusing on having something to make it special for adoption.

You’re right - it’s why there’s comments even in HN like “you can’t run C# on Linux” and the like.
D standard library uses much templates. So only what's used or what is not templatized get linked in the binary. The runtime somewhat tries to follows this too, aka the "pay-as-you-go" strategy as it is called in the dlang world.

For small applications this works even if certain templates can easily lead to have half of the standard library pulled in (e.g a few conversion, a few format, a few regex and boom, the size explodes).

A subset of the language called betterC allows to fully get rid of the "base", but requires to write much more code to get things done. Maybe this is why prakis managed to get the smaller binary ? The comment is not very clear about the methodology...