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

Performance regression in phase averaging #204

Closed
kbarros opened this issue Dec 23, 2023 · 1 comment
Closed

Performance regression in phase averaging #204

kbarros opened this issue Dec 23, 2023 · 1 comment

Comments

@kbarros
Copy link
Member

kbarros commented Dec 23, 2023

From @Lazersmoke:

3c43a43 reintroduced a lot of allocations into the inner loop that actually slow things down, and partially reverting (keeping the change to q instead of q_absolute) made it fast enough for my code to run again.

Strangely, when I committed that same patch, I benchmarked a very large speedup. Test files attached.
MgCr2O4-test.zip

kbarros added a commit that referenced this issue Jan 19, 2024
This resolves (#204). The solution is to pass `ntuple` the length statically as `Val{NAtoms}()`, rather than as a runtime value `Natoms`. This avoids reliance on compiler inlining.
@kbarros
Copy link
Member Author

kbarros commented Jan 19, 2024

Should now be fixed. For this updated benchmark, MgCr2O4-test.zip, I measure:

  • About 8s on Sunny v0.5.8.
  • 1.63s after reverting 3c43a43
  • 1.27s after keeping 3c43a43, and additionally applying the fix 90b9480.

That is, Sunny 0.5.9 will be 30% faster than any previous Sunny. The fix was to pass length information to ntuple statically, which avoids reliance on compiler inlining.

@kbarros kbarros closed this as completed Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant