Optimizing Rust Struct Size
https://camlorn.net/posts/April 2017/rust-struct-field-reordering.html (an optimisation that's not possible in C, because it would break ABI!)
miniblog.
Related Posts
Is there any relationship between language adoption and the size of its standard library?
These days it seems completely orthogonal, but early Java adopters spoke highly of the collections library compared with C++.
Maybe it's the widespread availability of package managers?
Today I learnt about crossterm, a Rust crate for interacting with terminals in a cross-platform way: https://docs.rs/crossterm/latest/crossterm/
It handles things like is_tty() and terminal::size(), which are hard to support correctly in both Linux and Windows. I might port difftastic.
Today I learnt that Cell<T> has the size of a pointer (i.e. probably 64 bits) in Rust, regardless of the size of T.
It's a common pattern for making struct fields mutable, but the T isn't actually stored inside the struct.