6 ms·
I never used D-lang in any production application. But for an IOT prototype where the executable size and performance were very important we benchmarked D also
by prakis 3y ago
I never used D-lang in any production application.
But for an IOT prototype where the executable size and performance were very important we benchmarked D also along with Go and C#.NET Core.
I made the same prototype in Go, C#, Java(GraalVM Native Compile) and D-lang. The results were surprisingly positive for D-lang.
Best Peformance -> D-lang, next Go and then Java(GraalVM), C#.NET Core.
Executable Size -> D-lang:500kb, Go: 2.5 MB, C# : 11MB, Java(GraalVM):8MB.
Our major concern with D-lang was lack of dependable(tested) standard libraries.
- amelius 3y agoQuestion: does D-lang use LLVM under the hood?
- gomoboo 3y agoD has 3 main compiler implementations. One, LDC, is based on LLVM: https://github.com/ldc-developers/ldc https://github.com/ldc-developers/ldc GDC is based on GCC: https://github.com/D-Programming-GDC/gdc https://github.com/D-Programming-GDC/gdc DMD is stand-alone: https://github.com/dlang/dmd https://github.com/dlang/dmd
- neonsunset 3y agoAOT size footprint of C# is now smaller than Go (as of .NET 8). Also performance is much better, just write code in a Rust-ish way (struct generics). If each language is used correctly, Go should come last on the benchmarks.
- chrismsimpson 3y agoStruct generic C# is where it’s at
- schemescape 3y agoC# AOT is down to 1 - 2 MB? Are any tricks required? Is it compressed? Does it have runtime dependencies? How is start up time? Last time I tried C# AOT (not sure what version, but it was in March of this year) I ended up with a 67 MB (static) executable. Edit: the docs mention a web app at 8.5 MB (static) on Linux: https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-8.0?view=aspnetcore-7.0 https://learn.microsoft.com/en-us/aspnet/core/release-notes/...
- neonsunset 3y agoGo's 2MB is just a hello world executable. Same for C# (it's about 1.4ish MB now). Once you start referencing heavy dependencies like networking stack or bits of async runtime, the binary will get larger. 8.5 MB while very optimistic (it will be usually larger for back-end applications, which is different to parent comment's IoT scenario), it is actually not far off what you'd get with Rust's Tokio + Axum + Serde + Reqwest and auxiliary crates to replicate the functionality that base ASP.NET Core offers.
- schemescape 3y agoGood point, I was thinking of Hello World. Regardless, < 10 MB for a nontrivial program is a huge improvement. Maybe I need to revisit C#…