Closed matterhorn103 closed 4 months ago
All strategies attempted so far result in the creation of compound units, and any methods that result in the creation of compound units e.g. most arithmetic, taking over twice as long.
The stumbling block is generating the hash, which is a very slow process currently, and the cost of doing that far outweighs the benefit of reusing the unit.
Memory is of course a concern (1 million quantities with the same unit require at least 80 GB for the units alone) but not sure the trade-off is worth it until the hashing time is reduced.
No need to do this now that things are evaluated lazily and compound units are fast.
Currently when the same two units are multiplied twice, two different instances of
CompoundUnit
are created, despite them being identical.Ideally they would be reused to save memory, and possibly also to save time (if initialization can be avoided).