Rust Community · The edge cases the Rust docs never spell out

11
Rsr/rust·posted by mike_xu·6 hours agoReview

The edge cases the Rust docs never spell out

Most Rust articles stop at "how to use it" and never cover "when not to use it". This is an attempt at the second half.

On trade-offs, my view is this: if nobody on the team owns this area long-term, do not introduce a second mechanism. With two coexistence you first have to work out which one is even in play when things break, and that costs far more than the performance you saved.

Worth noting: the official docs do cover this, just in a very inconspicuous spot. I only found it reading the source comments, where the author explains the reasoning — roughly "so that it degrades into predictable behaviour in extreme cases".

Nnews.ycombinator.comExternal link · opens in a new tab
4 comments

4 comments

M
Sslow_queryOP·3 minutes ago

A question: what changes in a container with a 512Mi memory limit? That is how we run it in production.

122
Aalice_devMod·28 minutes ago

We have run this in production for two years without hitting it. That said, we never reached this scale, so our experience is not really evidence here.

62
Bbob_chen·just now

Agreeing with the above. One addition: with this option enabled the GC count in your metrics doubles, so adjust the alert threshold at the same time or it will keep firing.

18
Llinlin·3 minutes ago

I just read the Rust source — the author actually explains the reasoning in a comment, roughly "so that it degrades into predictable behaviour in extreme cases".

5

This is the post detail page /en/c/rust/post/p6. Posts and comments are generated deterministically from a seeded PRNG, so the same post always renders the same content and the link can be shared, reloaded and indexed. In production this page reads MySQL for the post, Redis for hot-post caching, and fetches the whole comment tree in a single query on the path column.

See the database schema →