In general I think this would be best done with StructArrays.jl, so that the dimension-specific operations can be vectorized too. I’d be very curious to see how that changes your measurement.
Perhaps this is also because the dimensions are stored as SimpleRatio{Int}
rather than an Int8
(which is more amenable to vectorization)? @Oscar_Smith was suggesting this in the initial thread based on some measurements:
It’s likely that few people need more than an Int8
for physical dimensions. The tricky part is dealing with integer overflows if we stick with SimpleRatio
: even four repeated + (2//3) - (2//3)
would be enough to overflow Int8
. (Since SimpleRatio
doesn’t repeatedly divide by the gcd)