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 performance of is_energy_preserving via sparse matrices #138

Merged
merged 8 commits into from
Jun 15, 2023

Conversation

ranocha
Copy link
Owner

@ranocha ranocha commented Jun 15, 2023

This tackles the biggest chunk of #130.

Current main:

julia> using BSeries

julia> begin # second run after compilation

       # rational coefficients
       series = bseries(AverageVectorFieldMethod(), 10)
       @time is_energy_preserving(series)

       # floating point coefficients
       series = bseries(AverageVectorFieldMethod(Float64), 10)
       @time is_energy_preserving(series)

       end
  0.664049 seconds (119.29 k allocations: 88.295 MiB, 0.62% gc time)
  0.560968 seconds (118.06 k allocations: 80.759 MiB, 0.35% gc time)
true

This PR:

julia> using BSeries

julia> begin # second run after compilation

       # rational coefficients
       series = bseries(AverageVectorFieldMethod(), 10)
       @time is_energy_preserving(series)

       # floating point coefficients
       series = bseries(AverageVectorFieldMethod(Float64), 10)
       @time is_energy_preserving(series)

       end
  0.397417 seconds (111.10 k allocations: 13.948 MiB)
  0.327424 seconds (109.87 k allocations: 14.197 MiB)
true

With this PR, modified_equation takes 93% of the total runtime of is_energy_preserving(series) for series = bseries(AverageVectorFieldMethod(Float64), 10).

@ranocha ranocha marked this pull request as ready for review June 15, 2023 14:05
@ranocha ranocha merged commit 55a0700 into main Jun 15, 2023
@ranocha ranocha deleted the hr/sparse branch June 15, 2023 14:05
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.

1 participant