First of all I want to thank the Nim developers for trying to bring an alternative to well known compiled languages. I have a question about the executables produced on my system who is a windows 8.1, Nim 0.12 and Mingw X86_64 compilers provided in the Nim website binaries.
On this system a file with only a echo "Hello" code, was compiled in a .exe and I found 225 ko of size. The same file compiled with the --d:release command produces a 94 ko file.
I want to know if it's a correct behaviour for a Hello World, and if the executable of a real project have decent size comparing to binaries produced from C++.
I apologize for my bad english and for the noob question.
Yes, that seems correct. Real Nim programs still have a pretty small file size, see for example the Nim compiler or NimES: http://hookrace.net/blog/porting-nes-go-nim/#comparison-of-go-and-nim
This might also be interesting for you: http://hookrace.net/blog/nim-binary-size/
And, using clang, lto, dynamic linking can reduce executable size drastically. With clang or gcc with lto enabled I get executable sizes of less then 40k, and with dynamic linking about 10k. Without much effort, see
Thanks guys. I asked this because I tested Genie language a little bit and his hello world weights 47ko, like the C++ one, with the same GCC compiler and only the "valac" command for the vala compiler.
Anyway, I understand that Nim' executables size are surely pretty decent, and a simple hello world isn't representative enough. I dropped Genie because it includes some Glib code in these output files. I'm afraid this Glib under LGPL prohibits the static linking without having licensing issues. I don't want to spend a lot of time on a programming language if it could bite me too hard in the future.
So I want to ask if Nim, with default settings, is affected by this limitation ?
Personally I haven't used discard for commenting and just use # in each line.