Using @btime randn(5) .* Dimensions(mass=2/5, length=2) as a benchmark, I see a pretty big improvement going to Int8 instead of Int. It won’t make much difference for scalars, but for vectors, it cuts allocations by 75% and time by 19%.
Is there a way to do type-stable units without constraining the dimensions to a fixed set? I like to create dimensions like NumberOfBooks and calculate