core: improve stdcm heuristic using actual remaining distance #7417
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #6605
The implementation could be improved in some ways but it seems good enough and simple enough for now.
Average execution time is divided by roughly 2, same for std.
Execution time goes slightly up for the fastest requests.
Only one request goes above 100s now, it reaches the timeout limit (120s) but actually stops naturally with a "no path found" just before the exception would be raised.
The preprocessing only takes ~ 5% of the execution time, so we have quite a lot of margin to improve it further later on.
Benchmark on realistic requests (everything is in seconds,
describe
is from pandas):count 303.000000
mean 8.215783
std 20.534878
min 1.708356
25% 1.905426
50% 2.161869
75% 3.846870
max 123.005467
Name: time, dtype: float64
count 303.000000
mean 4.904902
std 11.438471
min 1.705818
25% 2.036432
50% 2.208790
75% 2.850309
max 120.813108
Name: time, dtype: float64
count 303.000000
mean -3.310882
std 14.979293
min -120.109074
25% -0.550600
50% -0.024111
75% 0.159067
max 33.703450
Name: time, dtype: float64