Part of the “Rustober” series.
If you look for “Rust compilation speed” or “Rust compile times” people complain quite a lot that Rust is slow to compile (here’s a fairly recent investigation of what contributes to that). At the same time, there are techniques that can reduce the total compilation time for a project by a significant factor (here’s a bit of an older post from 2021 on the topic).
To put some numbers on the issue, the recent Rust Compiler Performance Survey provides the following graph of rebuild time based on the number of dependencies which is what most people care about: how fast you can iterate while working on something.
OK, so it can be slow for larger projects, even though the survey also mentions that a big portion of the respondents never tried to optimize their builds in any way (so there is a lot of low-hanging fruit). Still, both in the survey results and in “The performancee of the Rust compiler” I see commitment to making the compiler faster, and if possible, dramatically faster.
From the survey:
We actually received many positive comments about users being happy with Rust build performance, and appreciation for it being improved vastly over the past several years to the point where it stopped being a problem. … We would love to get to a point where the time needed to rebuild a Rust project is dependent primarily on the amount of performed code changes, rather than on the size of the codebase, but clearly we are not there yet. … Our long-standing goal is to make compilation so fast that similar workarounds will not be necessary anymore for the vast majority of use-cases.
From the article:
This year (2024), the speed of the compiler has more than doubled. … Ultimately, while the Rust compiler’s performance is worse than many other languages, it’s something that the project is aware of and actively working on. Performance is improving, and despite the easy changes becoming harder to find, it is likely to continue improving.
In one of the Reddit posts, someone said that if people were coming from Go and Python, of course Rust would seem slow to them. But coming from C++ where builds can easily take hours? Rust does not seem “slow”.