<story><title>Improving Rust compile times to enable adoption of memory safety</title><url>https://www.memorysafety.org/blog/remy-rakic-compile-times/</url></story><parent_chain></parent_chain><comment><author>pornel</author><text>Another build time improvement coming, especially for fresh CI builds, is a new registry protocol. Instead of git-cloning metadata for 100,000+ packages, it can download only the data for your dependencies.&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;blog.rust-lang.org&amp;#x2F;inside-rust&amp;#x2F;2023&amp;#x2F;01&amp;#x2F;30&amp;#x2F;cargo-sparse-protocol.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;blog.rust-lang.org&amp;#x2F;inside-rust&amp;#x2F;2023&amp;#x2F;01&amp;#x2F;30&amp;#x2F;cargo-spar...&lt;/a&gt;</text></comment>
<story><title>Improving Rust compile times to enable adoption of memory safety</title><url>https://www.memorysafety.org/blog/remy-rakic-compile-times/</url></story><parent_chain></parent_chain><comment><author>burntsushi</author><text>I originally posted this on reddit[1], but figured I&amp;#x27;d share this here. I checked out ripgrep 0.8.0 and compiled it with both Rust 1.20 (from ~5.5 years ago) and Rust 1.67 (just released):&lt;p&gt;&lt;pre&gt;&lt;code&gt;    $ git clone https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;BurntSushi&amp;#x2F;ripgrep
    $ cd ripgrep
    $ git checkout 0.8.0
    $ time cargo +1.20.0 build --release
    real    34.367
    user    1:07.36
    sys     1.568
    maxmem  520 MB
    faults  1575
    
    $ time cargo +1.67.0 build --release
    [... snip sooooo many warnings, lol ...]
    real    7.761
    user    1:32.29
    sys     4.489
    maxmem  609 MB
    faults  7503
&lt;/code&gt;&lt;/pre&gt;
As kryps pointed out on reddit, I believe at some point there was a change to add&amp;#x2F;improve compilation times by making more effective use of parallelism. So forcing the build to use a single thread produces more sobering results, but still a huge win:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    $ time cargo +1.20.0 build -j1 --release
    real    1:03.11
    user    1:01.90
    sys     1.156
    maxmem  518 MB
    faults  0

    $ time cargo +1.67.0 build -j1 --release
    real    46.112
    user    44.259
    sys     1.930
    maxmem  344 MB
    faults  0
&lt;/code&gt;&lt;/pre&gt;
(My CPU is a i9-12900K.)&lt;p&gt;These are from-scratch release builds, which probably matter less than incremental builds. But they still matter. This is just one barometer of many.&lt;p&gt;[1]: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;old.reddit.com&amp;#x2F;r&amp;#x2F;rust&amp;#x2F;comments&amp;#x2F;10s5nkq&amp;#x2F;improving_rust_compile_times_to_enable_adoption&amp;#x2F;j6ztle9&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;old.reddit.com&amp;#x2F;r&amp;#x2F;rust&amp;#x2F;comments&amp;#x2F;10s5nkq&amp;#x2F;improving_rus...&lt;/a&gt;</text></comment>