-
-
Notifications
You must be signed in to change notification settings - Fork 167
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
ENH: Flight simulation speed up #581
Conversation
- Overall, this already speeds up the flight simulations
- better input validators - better set_source method - now the function _check_user_input is not called twice!
- set_interpolation - set_extrapolation - set_get_value_opt
- This reduces code lines and improve redability. - performance is similar, but now there's a map() in the code instead of a for loop
- Initializing a Function object is complicated. Instead, let's sum two Functions
Ok, here is more detailed comment regarding the performance of flight simulation.
Before the improvements done in this PR:
========================================
All 20 simulations done, it took 95.40774 seconds
Mean time: 4.77039
Standard deviation: 0.71902
All 20 simulations done, it took 92.84953 seconds
Mean time: 4.64248
Standard deviation: 0.66002
After the improvements done in this PR:
=======================================
All 20 simulations done, it took 50.86210 seconds
Mean time: 2.54310
Standard deviation: 0.12359
All 20 simulations done, it took 50.47766 seconds
Mean time: 2.52388
Standard deviation: 0.10919 Finally, I think this one is ready for review now, @RocketPy-Team/code-owners |
This PR, if merged, should solve the #481 issue. |
Hey, I'm requesting new reviews from @MateusStano and @phmbressan !! I hope you like it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty good!
Question: How much is the simulation sped up now?
Running 100 simulations with the Calisto rocket: Before this PR:
After this PR:
Overall, code much faster now! Tests are not passing due to a problem of hdf5 in python3.8 running on macOS. We will need to discuss it this week. |
This might be breaking the tests btw |
Yes, this is exactly what is breaking these tests. The way I see there are 2 options:
I started thinking about option 2, but IMO this PR is long enough already, I see option 1 as more beneficial for now. |
I believe the tests should be passing now. @phmbressan @MateusStano I would appreciate a last approve/review so we can finally merge this one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work done here, simulations are much quicker.
I re-reviewed the PR and the whole "extend vs append" discussion and I think the implementation here pretty good.
Hello, I'd like to request re-review @MateusStano or @phmbressan . Everything seems to be working correctly now. Tests were only slightly changed in this PR, returned values are practically identical. |
Pull request type
Checklist
black rocketpy/ tests/
) has passed locallypytest tests -m slow --runslow
) have passed locallyCHANGELOG.md
has been updated (if relevant)Current behavior
Simulation is taking too long to run!
New behavior
Read the commit history, one by one.
Some comments:
get_value_opt
method can be twice as faster as the normalget_value
method.Breaking change
Additional information
I am still running some tests within this branch.