Hacker News new | ask | show | jobs
by mpartel 954 days ago
Compilation times depend very heavily on the amount/size/complexity of dependencies.
4 comments

My project isn't large or even mid-sized, but it has over a hundred dependencies. Building the dependencies certainly takes some time on my raspberry pi 4, but after that initial hit, every change to the project builds a release in about 15 seconds, and a debug build in about 10.

And on my Macbook Air M2, where I actually develop, these things happen fast enough to call them instant. Perhaps I'm a bit spoiled there due to the excellent hardware. As a comparison, a Typescript project I'm working on using a more powerful Macbook always takes about 5-10 seconds to build.

I don't doubt that actually large Rust projects take a long time to build, though, but even these small and mid-sized were rather slow to build a few years ago.

To clarify, dependencies significantly affect incremental builds too. Seems loading information about compiled dependencies into the compiler and/or resolving stuff about them can take significant time.
And on having a fast CPU, RAM and disk.

It makes a huge difference.

For what it's worth, I'm working on a project with about 1000 dependencies and incremental debug build time is about 4 seconds on my laptop.

That's already pretty good.

I know you said 4s is good but have you tried changing the linker?

Number of dependencies likely won't affect incremental build times except for linking and replacing it might offer some good gains for incremental builds.

Oh that time is already with mold.

Default linker is quite a bit slower.

And also processor speed.