editoast: infra: order objects when downloading a railjson #6728
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.
This PR is there to compensate the fact that railjson import loads objects (track sections, signals, ...) in a random order in the db.
Then, if you import and export a railjson, the order of the objects change randomly. This randomness affects the results of the circulation import benchmark (today if you import the same railjson twice, and run the circulation import benchmark on each, the results aren't the same). This PR tries to fix that.
I ran this code before and after.
Before:
first call: 2.50 seconds
mean: 2.11 seconds
stdev: 0.05 seconds
After:
first call: 2.65 seconds
mean: 2.34 seconds
stdev: 0.04 seconds
I'm not 100% certain that the results can be trusted, the performance of the endpoint seems very variable depending on the context.
So there is a bit more than a 10% of time increase with this PR, do you think it's acceptable ? If not, I can try adding indexes to the
obj_id
columns and run another benchmark.