Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> It's not surprising that your "target" directory (where both the intermediate and final objects are stored) is that big.

Actually this is surprising to me. All it does is parse command-line arguments. I am surprised that this creates 143 million bytes of information.

I accept that I was wrong to say this data is "downloaded" off crates.io, since it is in fact created locally.

> 11 of your dependencies together (including clap)

This is obviously a matter of taste, but to me, this is too many. In the event that sensible command line parsing is not part of the core language, it could at least only be a single dependency.



There are several reasons:

1. Unoptimized builds tend to be excessively large. LLVM's opt binary (citing this because it's something I have easy access to) is 30x larger on an unoptimized build than an optimized build. [I think Rust is even worse than C++ at the unoptimized/optimized size ratio]

2. Debugging information is also excessively large. It's not counted in the above statistics I gave because I use split debug information (which keeps it out of the final executable for easier linking), but you're looking at debug information being a significant fraction of code size--maybe half of the total binary size could be debug information.

3. Because you include the build directory, you're carrying two copies of everything, minimum--both the .o files and the executable they link into.

For a rough comparison of LLVM, the llvm source directory I have is 1.5G, the optimized release build I have is 15G (of which 1.7G is the actual binary executables), and the unoptimized debug build I have is 86G. Of course LLVM is unusual in producing a very large number of statically linked executables.

4. One of the dependencies inside clap is the procedural macros stuff (specifically, quote/syn crates), which basically requires building your own copy of the Rust parser. If you drop that dependency, the build directory sizes should be far, far smaller.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: