-
Notifications
You must be signed in to change notification settings - Fork 29
POC improve transfers #993
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
base: master
Are you sure you want to change the base?
Conversation
f65e920 to
aa341c5
Compare
aa341c5 to
6b58bb3
Compare
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.
Pull Request Overview
This PR optimizes the transfer generation algorithm from O(n²) to O(n×k) complexity using a spatial grid data structure. The function signature changes from returning Model to returning Collections, requiring callers to rebuild the model if needed.
- Introduces a
SpatialGridstructure to partition geographic space and enable efficient proximity queries - Adds comprehensive performance logging to track grid construction, comparison counts, and timing metrics
- Changes
generates_transfersreturn type fromResult<Model>toResult<Collections>
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/transfers.rs | Implements spatial grid optimization, adds performance metrics, changes return type to Collections |
| src/ntfs/mod.rs | Updates write function signatures to accept Collections instead of Model |
| ntfs2ntfs/src/main.rs | Adjusts caller to handle Collections return type |
| gtfs2ntfs/src/main.rs | Adjusts caller to rebuild Model from returned Collections |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/transfers.rs
Outdated
| let new_model = result.unwrap(); | ||
| let transfer_count = new_model.transfers.len(); |
Copilot
AI
Nov 4, 2025
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.
The variable is named new_model but the function now returns Collections, not Model. This causes a type mismatch - new_model should be renamed to collections or similar to match the actual type.
| let new_model = result.unwrap(); | |
| let transfer_count = new_model.transfers.len(); | |
| let collections = result.unwrap(); | |
| let transfer_count = collections.transfers.len(); |
| let mut collections = model.into_collections(); | ||
| collections.transfers = Collection::new(new_transfers); | ||
| Model::new(collections) | ||
| // let result = Model::new(collections); |
Copilot
AI
Nov 4, 2025
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.
This commented-out code should be removed rather than left in the codebase as it serves no purpose and adds clutter.
| // let result = Model::new(collections); |
Uh oh!
There was an error while loading. Please reload this page.