top | item 36928885

(no title)

prakis | 2 years 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.

discuss

order

fuzztester|2 years ago

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

ivolimmen|2 years ago

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.

lloydatkinson|2 years ago

Not necessarily anymore now that .NET has had a lot of enhancements for compiling to native and stripping unused references.

sixthDot|2 years ago

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...