SunnySuite / Sunny.jl

Spin dynamics and generalization to SU(N) coherent states
Other
79 stars 19 forks source link

Performance regression in phase averaging #204

Closed kbarros closed 7 months ago

kbarros commented 8 months ago

From @Lazersmoke:

https://github.com/SunnySuite/Sunny.jl/commit/3c43a43685fac5a86e30a99f4dc1d4bf1baf8521 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 commented 7 months ago

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

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.