MichalStrehovsky / sizegame

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

OS Choice Question #2

Closed delneg closed 1 year ago

delneg commented 1 year ago

Hello, The repository idea is very interesting, however, I've noticed that everything is measure on windows, which is a rather odd choice of OS Will there be a comparison for Linux and macOS as well (possibly even *BSD where applicable) ?

Thanks in advance !

biovolt commented 1 year ago

I agree. :-) e.g. swift would probably be a lot smaller without including vcruntime140.dll, vcruntime140_1.dll, msvcp140.dll

WhiteBlackGoose commented 1 year ago

I was also confused that it's being referred to as "Vanilla OS", whereas Vanilla OS is an immutable Ubuntu-based GNU/Linux distrubution, entirely unrelated to Windows :smile:

MichalStrehovsky commented 1 year ago

I think BSD or macOS could make sense. I personally don't care about macOS so that one is not going happen as long as I have to maintain it and the effort is non-zero.

I thought about Linux but I struggle with how to define the rules. Symbol stripping? What to do about libc? Link dynamically or statically? Which libc? Linux has usermode api but honestly any language will depend on libc because the usermode apis the kernel brings to the table are... insufficient. But that gives c a huge advantage. I honestly don't know how to define this.

swift would probably be a lot smaller without including vcruntime140.dll, vcruntime140_1.dll, msvcp140.dll

The binaries are in the releases tab of this repo. The problem with swift size is swiftcore. The rest are peanuts.

PJB3005 commented 1 year ago

Just pick an old stable Ubuntu version like 18.04 and leave it at that. It's true C will have an advantage, but oh well?

For symbol stripping: some languages like Rust will not have panic backtrackes if you do (similar to go) so maybe leave it at default except "compile on release"?

delneg commented 1 year ago

Just pick an old stable Ubuntu version like 18.04 and leave it at that. It's true C will have an advantage, but oh well?

For symbol stripping: some languages like Rust will not have panic backtrackes if you do (similar to go) so maybe leave it at default except "compile on release"?

I agree, IMO it's best to just use "default release" version, and not tweak parameters for different languages which can give some of them an advantage Also, C is gonna be the best anyway, so why bother ?

hyc commented 1 year ago

asm should be smaller than 2KB, no? On a POSIX system you just need to JMP to the write() syscall. Don't even need to exit() or return.

PJB3005 commented 1 year ago

asm should be smaller than 2KB, no? On a POSIX system you just need to JMP to the write() syscall. Don't even need to exit() or return.

  1. The current measurements are on Windows, you can't do that there.
  2. I don't think this is the correct thread for that.
  3. Even on Linux it's not clean to do that, since libc is not designed to be bypassed like that (like it is on Windows).
michaldobrodenka commented 1 year ago

I would like to see tests on linux-arm :)