Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert unsafe @pure annotations #58

Open
NHDaly opened this issue Aug 28, 2020 · 0 comments
Open

Revert unsafe @pure annotations #58

NHDaly opened this issue Aug 28, 2020 · 0 comments

Comments

@NHDaly
Copy link
Member

NHDaly commented Aug 28, 2020

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-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, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant