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 batch pathfinding performances #8035

Merged
merged 2 commits into from
Jul 12, 2024
Merged

Conversation

flomonster
Copy link
Contributor

Description

This PR tries to improve calls to simulation_summary when train schedules are not cached to redis.

  • Fixing the --no-cache option
  • Reducing the number of call perform to the database

Benchmark

  • Run simulation_summary endpoint on 30 train schedules timetable (all valid)
  • --no-cache option is enabled

Before

Time: 1.15s
Number of DB queries: 236

begore

After

Time: 937ms
Number of DB queries: 5

after

@flomonster flomonster requested a review from a team as a code owner July 11, 2024 23:49
@flomonster flomonster changed the title Improve batch pathfinidng Improve batch pathfinding performances Jul 11, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jul 11, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 215 lines in your changes missing coverage. Please review.

Project coverage is 28.06%. Comparing base (814e018) to head (b0214a2).

Files Patch % Lines
editoast/src/views/v2/path/path_item_cache.rs 0.00% 184 Missing ⚠️
editoast/src/views/v2/path/pathfinding.rs 0.00% 16 Missing ⚠️
editoast/src/views/v2/timetable/stdcm.rs 0.00% 9 Missing ⚠️
editoast/src/redis_utils.rs 0.00% 4 Missing ⚠️
...st/editoast_schemas/src/infra/operational_point.rs 0.00% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #8035      +/-   ##
============================================
- Coverage     28.07%   28.06%   -0.01%     
  Complexity     2075     2075              
============================================
  Files          1288     1289       +1     
  Lines        157729   157764      +35     
  Branches       3121     3121              
============================================
- Hits          44283    44281       -2     
- Misses       111569   111606      +37     
  Partials       1877     1877              
Flag Coverage Δ
core 75.03% <ø> (ø)
editoast 70.80% <0.00%> (-0.10%) ⬇️
front 9.94% <ø> (ø)
gateway 2.34% <ø> (ø)
railjson_generator 87.49% <ø> (ø)
tests 72.93% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@flomonster flomonster requested review from woshilapin and Castavo July 12, 2024 07:42
Copy link
Contributor

@Castavo Castavo left a comment

Choose a reason for hiding this comment

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

Nice optimization !

(This patch has 0% coverage 👀)

editoast/src/views/v2/path/path_item_cache.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/path_item_cache.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/path_item_cache.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/pathfinding.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/pathfinding.rs Outdated Show resolved Hide resolved
@flomonster flomonster requested a review from Castavo July 12, 2024 09:55
Copy link
Contributor

@Castavo Castavo left a comment

Choose a reason for hiding this comment

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

Neat

editoast/src/views/v2/path/path_item_cache.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@woshilapin woshilapin left a comment

Choose a reason for hiding this comment

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

Mostly naming considerations. In general, this should help a lot to be more gentle on the DB, so nice work!

editoast/src/views/v2/path/pathfinding.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/pathfinding.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/path_item_cache.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/path_item_cache.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/path_item_cache.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/path_item_cache.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/path_item_cache.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/path_item_cache.rs Outdated Show resolved Hide resolved
editoast/src/views/v2/path/pathfinding.rs Show resolved Hide resolved
editoast/src/views/v2/path/pathfinding.rs Outdated Show resolved Hide resolved
@flomonster flomonster force-pushed the fam/improve-batch-pathfinidng branch from 2a924af to 366cc35 Compare July 12, 2024 16:00
Reduce number of call perform to the database
@flomonster flomonster force-pushed the fam/improve-batch-pathfinidng branch from 366cc35 to b0214a2 Compare July 12, 2024 16:16
@flomonster flomonster enabled auto-merge July 12, 2024 16:22
@flomonster flomonster added this pull request to the merge queue Jul 12, 2024
Merged via the queue into dev with commit e65899e Jul 12, 2024
20 checks passed
@flomonster flomonster deleted the fam/improve-batch-pathfinidng branch July 12, 2024 16:34
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.

4 participants