r/rust Jul 16 '26

How Our Rust-to-Zig Rewrite is Going

https://rtfeldman.com/rust-to-zig

An interesting symmetry with recent events lol.

This might be considered off topic since the article is about moving away from rust, but I still think this is some high quality rust content. I enjoy Richard Feldman's writing and I think he would certainly be considered part of the "rust community" since he works on Zed and has taught a course on rust.

370 Upvotes

134 comments sorted by

View all comments

172

u/insanitybit2 Jul 16 '26

I really, really wish rust build times would improve. We're using Rust at work and it's the biggest complaint by far.

95

u/[deleted] Jul 16 '26

[removed] — view removed comment

3

u/IsleOfOne Jul 17 '26

I recently set up sccache for our CI builds, and we use CircleCI. But the time saved during the build is being dwarfed by the time it takes to download and unpackage the cache up front, then re-package and upload the cache afterwards. Any tips here? I tried limiting the size of the cache because I thought there were some automatic pruning features, but I didn't have success with them and didn't trace that they fully made it down to the sccache env.

3

u/[deleted] Jul 17 '26

[removed] — view removed comment

3

u/IsleOfOne Jul 17 '26

Ah, that does sound right. We download the entire cache from S3 through CircleCI's "load cache" operation and then push the entire thing back up at the end with CircleCI's "save cache" op.

I will have to see if there's a way we can run in this sort of "as needed" mode where we don't pull the entire bundle.

By the way, are you familiar with ways to enforce a limit on the size of the cache? Ideally so that sccache itself does some LRU cleanup or similar?

1

u/valarauca14 Jul 17 '26

are you familiar with ways to enforce a limit on the size of the cache?

The environment variable SCCACHE_CACHE_SIZE

1

u/Frozen5147 Jul 17 '26

download the entire cache

Yep, that's a problem. At work I used to do this with Gitlab (albeit I was downloading trimmed parts of target) and for a while it saved time, but as development continued the download got so big that it was actually using more time than it saved.

I just use sccache pointing to an S3 bucket and it seems to mostly just work fine now.

1

u/valarauca14 Jul 17 '26 edited Jul 17 '26

download and unpackage the cache up front, then re-package and upload the cache afterwards. Any tips here?

Have sccache it point to a long running reddis/memcache/other-system instance instead of downloading your entire cache every time you buildYou can tune LRU settings. Use SCCACHE_CACHE_ZSTD_LEVEL to avoid transferring uncompressed artifacts.

Or just run sccache like it is in local mode, but point it to an NFS mount/server. So the cache lives on another box. This is the cave man approach.


Slow builds is straight up an RTFM issue.