Hacker News new | ask | show | jobs
by ubedan 762 days ago
Are the requirements for fast rust compilation written down somewhere? Is that something you'd consider sharing, possibly with all of the tricks you've learned about how to get around various situations that would otherwise lead to slow compilations?
2 comments

In this specific case the fast compilation is down to having 0 dependencies.

Rust is usually only rivalled by npm in terms of number of dependencies that a typical project pulls. This project is a refreshing take!

people using deps for trivial things and those trivial things pulling 100s more deps for more trivial things is not really a rust or npm issue. its an issue of people becoming really lazy in light of amazing package management tools. its weird how good pkg mgmt has this totally shit side effect for compilation, but it sure makes buildong things faster. (which in rusts case i guess can go a long way as coding stuff can also take alot of time, not familiar with js land there)
Yea most dependencies in Rust land are entirely avoidable. Most even easily (like left-pad), sometimes its hard like a wasm engine. This wasm engine is the result of us trying to avoid a dep on a wasm engine from the ecosystem. It bloated the build time of our IDE by 300% to just include it (we were just 25% of the buildtime if i include wasmtime). Now was that a good idea? I don't know but we're getting very close now to a full product whilst still compiling in release build with all deps in <10s on a new mac. I'm personally really opposed to using small convenience libraries. Just write the code you need in a 'slightly less convenient way'. Use the standard library if you can. No need to pile on say entire networking stacks if you can talk to the platform networking apis for instance.
> its weird how good pkg mgmt has this totally shit side effect for compilation,

that's because the package management tools aren't amazing, those would distribute prebuilt stuff pluggable into your project with close to 0 build time overhead vs. today where everyone has to constantly build all the deps

Essentially it is: avoid all dependencies, and if you take them on, like platform libs strip them down to only what you use