3 ms·
If you're using an SoA pattern you're already optimizing for performance and, imo, should be using null to begin with.
by vips7L 4y ago
If you're using an SoA pattern you're already optimizing for performance and, imo, should be using null to begin with.
- pdpi 4y agoThat's the point, though. Java's Optional<T> always incurs that extra cost, but e.g. Kotlin's T? doesn't have that (because ? just allows null), and Rust has an optimisation for Option<Box<T>> that reduces the representation to a single pointer (and the empty case is a null pointer). You absolutely can have that level of optimisation while still having the optional type.