3 ms·
I think the point is not really to compare Java to Rust but highlight that in Java you pay a significant performance penalty (relative to representing Optional.
by thinkharderdev 5y ago
I think the point is not really to compare Java to Rust but highlight that in Java you pay a significant performance penalty (relative to representing Optional.empty() as null).
- tialaramex 5y agoAnd without the Rust code, you just know people would say see, Optional is too expensive, this is why I use null. So the Rust here shows that actually no, this style doesn't need to come with a performance cost. It's been more of a surprise to me to see people defending null as somehow preferable style in these comments.
- spullara 5y agoI think what they are saying is that it is the preferrable style in Java for now. As soon as Vahalla lands in the VM, then Optional in Java will be closer to Rust.