Re:Overhead of Returning Optional Values in Java and Rust
by thinkharderdev on Saturday October 16, 2021 @02:37PM
(#28890248)
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).
[ Parent
| on HN ]
Re:Overhead of Returning Optional Values in Java and Rust
by tialaramex on Saturday October 16, 2021 @03:34PM
(#28890741)
And 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.