4 ms·
>small union which julia handles efficiently at runtime Oh! I didn't realize Julia already optimized small unions. https://julialang.org/blog/2018/08/union-sp
by hexane360 5y ago
>small union which julia handles efficiently at runtime
Oh! I didn't realize Julia already optimized small unions.
https://julialang.org/blog/2018/08/union-splitting/ https://julialang.org/blog/2018/08/union-splitting/
https://docs.julialang.org/en/v1/devdocs/isbitsunionarrays/ https://docs.julialang.org/en/v1/devdocs/isbitsunionarrays/
I wasn't quite sure whether something like this was possible given the semantics of Julia.
Personally, I'd still prefer something more explicit, so it would be more obvious when a union is being handled efficiently. But given that small unions are optimized, I can see why Julia would make the opposite decision.
This makes me feel a lot better about writing Julia code with union types. Thanks
- eigenspace 5y agoYep, small union optimizations are a godsend!