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

Remove some uses of @pure #1253

Merged
merged 1 commit into from
May 16, 2024
Merged

Remove some uses of @pure #1253

merged 1 commit into from
May 16, 2024

Conversation

mateuszbaran
Copy link
Collaborator

I think it will be much easier to track potential performance regressions when pure removal is split into a few steps. This is the first one.

@mateuszbaran mateuszbaran added the housekeeping General project health label May 11, 2024
@mateuszbaran mateuszbaran merged commit c4092a1 into master May 16, 2024
25 of 26 checks passed
@mateuszbaran mateuszbaran deleted the mbaran/no-more-pure branch May 16, 2024 12:49
Comment on lines +48 to +50
@generated function triangularroot(::Val{L}) where {L}
return div(isqrt(8 * L + 1) - 1, 2) # from quadratic formula
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this have to be a @generated function with a Val argument? To me it looks like constant propagation works like a charm for plain

triangularroot(L::Int) = div(isqrt(8 * L + 1) - 1, 2)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to tell for me how it would interact with inlining if it were a normal function. We can always change it in a later PR.

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

Successfully merging this pull request may close these issues.

2 participants