There Is Life Before Main in Rust
Posted by mmastrac 5 days ago
Comments
Comment by mmastrac 4 days ago
There's a decent amount of knowledge around pre-main work in Rust, but I think this is one of the first attempts to walk through mutable link sections, which open up a pretty wide world of optimization, IMO. Even without mutability, I figured there isn't nearly enough documentation on these approaches out there.
(1) https://docs.rs/scattered-collect/0.20.0/scattered_collect/m...
(2) https://docs.rs/scattered-collect/0.20.0/scattered_collect/s...
Comment by jeffbee 4 days ago
Comment by ameliaquining 4 days ago
* Which you should think very carefully before concluding is the case, as it's responsible for rather a lot of bugs in C++. I think in Rust it is mostly used for registry-pattern type stuff since the const system can't currently(?) handle that.
Comment by Animats 4 days ago
Order of initialization can be supported at various levels:
- Completely random (OK if interdependence are locked out, otherwise bad)
- Consistent, but sorted by something such as alphabetical name (meh.)
- Manual, controlled in linker scripts (headache)
- True dependency tree order, including diagnosing loops (seen in the Modula family).
General comment: yes, you can, and you probably shouldn't unless you have profiling data that indicates a significant performance improvement for a critical use case.
Comment by ameliaquining 4 days ago
Comment by Animats 4 days ago
Comment by ameliaquining 4 days ago
Comment by rcxdude 3 days ago
Comment by Animats 3 days ago
Comment by kibwen 4 days ago
Comment by smy20011 4 days ago
Love this, I hope every blog have the same disclaimer about how AI is used.
Comment by rootnod3 4 days ago
Comment by frakt0x90 4 days ago
Comment by ronsor 4 days ago
Comment by wahern 4 days ago
Comment by mmastrac 4 days ago
Comment by vitally3643 4 days ago
Comment by orthecreedence 4 days ago
Comment by hresvelgr 4 days ago
Comment by khuey 4 days ago
Comment by sophacles 4 days ago
Further, can anything be "100% human writt even if it uses pen and paper? No of course not! Unless it is created by pricking a finger and put on human vellum, it's only partially human written.
Seriously though - if you want to do stupid purity test games, at least be properly pure about it. This half-assed nonsense is just trite.
Comment by Sharlin 4 days ago
Comment by wild_pointer 4 days ago
Comment by ryanshrott 3 days ago
Comment by Surac 4 days ago