An Optimization That's Impossible in Rust
27 points
12 days ago
| 3 comments
| tunglevo.com
| HN
aw1621107
12 days ago
[-]
Title is sort of clickbaity, as the article is about implementing said "impossible" optimization in Rust. I wasn't sure what a good alternative title would be, though, if this is one of those cases where using an alternative title is acceptable. I'm open to suggestions!
reply
capitainenemo
8 days ago
[-]
I mean, they weren't wrong if they meant "safe rust only" - so the title is still kind of correct right?
reply
raggi
8 days ago
[-]
No, this idea that unsafe blocks “are not rust” is wrong. Getting unsafe correct is hard, and so needs to be approached with care and first time buyers would do well to get advice from a friendly neighbor, but it’s a normal solution to some rare (code volume wise) cases. The best practice is to always document the safety constraints and reasoning above the blocks and some crate attestations will not be granted without those.
reply
Waterluvian
8 days ago
[-]
I love the concept so much. For me it just means “this block lacks a number of guarantees. Review it (and test it if you’re the author) far more carefully.”
reply
gpm
8 days ago
[-]
Which suggests the solution of changing the title from "impossible in rust" to "impossible in safe rust".
reply
bryanlarsen
8 days ago
[-]
The OP links to a quote where somebody else calls this "impossible in rust". That link makes this a valid title. Clickbaity, like good titles in 2024 are.
reply
Johnbot
7 days ago
[-]
The quoted optimization in the post isn't about German strings though, but the C++ style short string optimization (the post references an article describing the difference). A few of the referenced crates do this optimization so the blog is still right to point out that it's completely possible, I just wish it was clearer what optimization they felt was being claimed to be impossible.
reply
thecleaner
8 days ago
[-]
How much time would it take to port RocksDB in Rust hypothetically.
reply