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

Improve _apply_plan type stability #494

Conversation

niklasschmitz
Copy link
Collaborator

The pattern T = ForwardDiff.tagtype(eltype(x)) caused type instabilities in the Dual construction after, so I replace it by an explicit static type parameter declaration @antoine-levitt

Before:

julia> @btime compute_stresses(scfres)
  249.188 ms (2620837 allocations: 246.87 MiB)
3×3 Matrix{Float64}:
 -0.00122464   -2.29076e-18   1.19015e-17
 -2.29076e-18  -0.00122464    5.35591e-18
  8.12389e-18   8.93639e-19  -0.00122464

After:

julia> @btime compute_stresses(scfres)
  66.461 ms (28773 allocations: 112.10 MiB)
3×3 Matrix{Float64}:
 -0.00122464   -2.29076e-18   1.19015e-17
 -2.29076e-18  -0.00122464    5.35591e-18
  8.12389e-18   8.93639e-19  -0.00122464

@antoine-levitt antoine-levitt merged commit 32f8f6f into JuliaMolSim:stresses_API Jul 19, 2021
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

Successfully merging this pull request may close these issues.

2 participants