JuliaMath / JuliaMath/FixedPointDecimals.jl
Revert unsafe `@pure` annotations
- Dominant language
- Julia
- Stars
- 37
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
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](https://www.youtube.com/watch?v=JCFej--XER0)), 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-in `Base.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](https://github.com/NHDaly/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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.