4 ms·
No. 2.17 MB is NOT enormous. Usually there is no runtime library. In contrast, C or C++ runtime libraries can easily exceed that size. For example, vc_redist.x6
by c_shu 9y ago
No. 2.17 MB is NOT enormous. Usually there is no runtime library. In contrast, C or C++ runtime libraries can easily exceed that size. For example, vc_redist.x64.exe is 13.9 MB.
- joosters 9y ago(Note: The size in the article is 21.7 MB, and not 2.17 MB!) I just tried building a statically linked 'hello world' c++ program, and co-incidentally, the binary also happened to be 2.1 MB! #include <iostream> int main( int, const char *[] ) { std::cout << "Hello World!" << std::endl; return 0; } 'g++ -static -o hello hello.cpp' produces a binary of 2191112 bytes (Linux x64). Stripping it of debug symbols leaves a 1.7 MB file.
- taspeotis 9y agohttp://www.muppetlabs.com/~breadbox/software/tiny/teensy.html http://www.muppetlabs.com/~breadbox/software/tiny/teensy.htm...
- unscaled 9y agoIt's a matter of platform and the libraries that you're using. After all, back in the days we had 360k floppy disks, and executable written in C which did much more than just printing out "Hello world" would fit comfortably into less than half of that. Modern C and C++ runtimes are bloated, because a 2MB executable isn't considered huge anymore and dynamic linking is common. But you can have a 5k static executable printing "hello world" on Linux if you just trade in your stdlibc to musl. People have also managed to use musl with Rust to produce pretty small executables: https://lifthrasiir.github.io/rustlog/why-is-a-rust-executable-large.html https://lifthrasiir.github.io/rustlog/why-is-a-rust-executab...
- deleted 9y ago[deleted]