MichalStrehovsky / sizegame

Compare binary sizes of canonical Hello World in 18 different languages
209 stars 17 forks source link

Add D #19

Closed azihassan closed 1 year ago

azihassan commented 1 year ago

Looks like D produces a ~500 kb executable on Windows

Edit: with -release because dmd creates debug builds by default

cyrusmsk commented 1 year ago

There are many ways to decrease size of the executable. Many of them presented in Discord group: https://discord.com/channels/242094594181955585/1069135807648108624 For simple hello world you can also try to use core.stdc.stdio: puts

MichalStrehovsky commented 1 year ago

Writeln is the correct API to use. It matches what is used in https://wiki.dlang.org/Getting_Started and a recommended book as well. See #4 and the rules.

The goal is not to get minimal size (that often requires disabling advertised features), but the canonical experience.

MichalStrehovsky commented 1 year ago

Thank you @azihassan!

azihassan commented 1 year ago

Thanks, interesting benchmark. I considered using dmd-latest at first, but ended up changing it to a hardcoded version since I noticed that the echo lines of the other language setups display hardcoded versions of the compiler. Then again they also use the latest compiler versions

@cyrusmsk agreed, I intended to submit a betterC version but decided against it after realizing that the repo is asking for regular hello world code snippets with regular compiler flags.