Thanks for reporting this. I think that’s a case where the optimizations for Union{T, Null}
have not been fully implemented in Julia 0.7 yet. Specifically, inlining of next
does not happen (see this explanation by @quinnj), which kills performance for such a simpler iterator object.
However, Julia 0.7 is about twice faster than Julia 0.6 in my tests, so that’s already a good sign (of course that’s not acceptable). Until optimizations have landed, better continue to use DataArrays, which are going to be ported to Nulls soon so that the ecosystem becomes more consistent.
We should definitely add a few test cases like this to Nulls using PkgBenchmark (or even in Base, as this is a common pattern).