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

core: use binarysearch algorithm to improve method getMaxEffort #2938

Merged
merged 1 commit into from
Feb 2, 2023

Conversation

majaziri
Copy link
Contributor

@majaziri majaziri commented Jan 18, 2023

Closes #2851

@majaziri majaziri requested a review from a team as a code owner January 18, 2023 16:32
@majaziri majaziri changed the title core: improve getmaxeffort method core: use binarysearch algorithm to improve method getMaxEffort Jan 18, 2023
@codecov
Copy link

codecov bot commented Jan 20, 2023

Codecov Report

Merging #2938 (c06f24b) into dev (53b6a18) will increase coverage by 0.04%.
The diff coverage is 100.00%.

❗ Current head c06f24b differs from pull request most recent head 68a8a1d. Consider uploading reports for the commit 68a8a1d to get more accurate results

@@             Coverage Diff              @@
##                dev    #2938      +/-   ##
============================================
+ Coverage     38.29%   38.34%   +0.04%     
- Complexity     1713     1716       +3     
============================================
  Files           600      600              
  Lines         18342    18355      +13     
  Branches       2513     2516       +3     
============================================
+ Hits           7024     7038      +14     
  Misses        10912    10912              
+ Partials        406      405       -1     
Flag Coverage Δ
core 83.93% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...fr/sncf/osrd/envelope_sim/PhysicsRollingStock.java 100.00% <100.00%> (+10.00%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

axrolld
axrolld previously approved these changes Jan 20, 2023
Copy link
Contributor

@flomonster flomonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few things should be adapted. Can you run a profiler to validate that this change actually improve performances.

axrolld
axrolld previously approved these changes Jan 20, 2023
Copy link
Contributor

@axrolld axrolld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The effort returned is correct, you can consider the pysics part approved.

Copy link
Contributor

@flomonster flomonster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for a benchmark

@majaziri
Copy link
Contributor Author

benchmark.ods
After 20 iteration, i managed to fill this file to test the 'act' method in StandaloneSimulationEndpoint.
the values provided are in nanoseconds, they are slightly improved compared to the original code.
The first column represents the average of all 20 iterations.

@bloussou
Copy link
Contributor

bloussou commented Jan 31, 2023

Which tool did you use to run the iteration ?

@majaziri
Copy link
Contributor Author

majaziri commented Feb 1, 2023

Which tool did you use to run the iteration ?

I calculated the difference of time between the start and the end of the method

@bloussou
Copy link
Contributor

bloussou commented Feb 1, 2023

Ok, in the future to test such code you can use tools like java-micro-benchmark : https://www.baeldung.com/java-microbenchmark-harness in order to see jvm optimizations like jvm warmup (because 20 iterations is not enough to see these iterations). We can talk about it later if you have such benchmark to run in the future 😄

@flomonster flomonster merged commit f7c190d into dev Feb 2, 2023
@flomonster flomonster deleted the mji/improvemaxeffort branch February 2, 2023 08:56
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.

Improve getMaxEffort by using binary search
6 participants