Open
Description
Last year, we made several performance improvements to FixedPointDecimals, and a lot of them used @pure
to enforce constant folding.
However, since then (as discussed in last year's JuliaCon talk If Runtime isn't Funtime), I've come to understand that the @pure
annotations I've added here are unsafe, because FixedPointDecimals supports arbitrary integer types, and it's not safe to use @pure
with user-defined types.
We should revert these annotations before we can make another release.
Long term:
- It would be safe to use
@pure
if we restricted FixedPointDecimals to the built-inBase.BitInteger
types, so we could consider separately defining a version of these functions for the built-in types that are@pure
and a non-pure version as the fallback. - Or we could try to put more work into StagedFunctions.jl, which could be used to provide the same level of performance but currently adds non-trivial compilation time overhead.
- Or we could do some more thinking to see if there's another solution.
For now, we should probably just revert the annotations, at least.