Nim binary size from 160 KB to 150 Bytes
hookrace.net
Nim binary size from 160 KB to 150 Bytes
1–10 of 69 posts
Re: Nim binary size from 160 KB to 150 Bytes
#2Re: Nim binary size from 160 KB to 150 Bytes
#3Nice achievement! The article is quite the journey through various build parameters, switching gcc for clang and glibc for musl along the way. In the end, the secret sauce is syscalls and custom linking, though (as always with this kind of thing).
Re: Nim binary size from 160 KB to 150 Bytes
#4* Nim/GCC gains 2 bytes by smartly reusing the previously set AX register's value to set DI where Rust/Clang uses an immediate
* Nim can't express that stuff after the EXIT syscall is unreachable and wastes a byte on a RETQ.
Re: Nim binary size from 160 KB to 150 Bytes
#5To me it looks like it makes the unsafety of c more accessible because of better tooling and nicer syntax. Looking at e.g. [1] there are still pointers, null-pointers etc, just like in c. So now you have a language that looks superficially simple but is actually very dangerous. Compare this to e.g. rust which was the most painful thing I learned recently but I also know that it brings something fundamentally new to the table.
Anyway, there's a lot I don't understand about Nim and I'd be happy to see evidence to the contrary.
[1] http://nim-lang.org/0.11.0/tut1.html#advanced-types-referenc...
Re: Nim binary size from 160 KB to 150 Bytes
#6Today I looked at Nim in a bit more depth because it keeps popping up. I have a slightly uncomfortable feeling about it that I hope is unfounded! To me it looks like it makes the unsafety of c more accessible because of better tooling and nicer syntax. Looking at e.g. [1] there are still pointers, null-pointers etc, just like in c. So now you have a language that looks superficially simple but is actually very danger…
Re: Nim binary size from 160 KB to 150 Bytes
#7Did I miss where he optimized for speed?
Re: Nim binary size from 160 KB to 150 Bytes
#8"The speed optimized binary is much smaller..." Did I miss where he optimized for speed?
Re: Nim binary size from 160 KB to 150 Bytes
#9"The speed optimized binary is much smaller..." Did I miss where he optimized for speed?