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

Use Index<Stop> instead of Arc<Stop>: Id as integer #123

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

antoine-de
Copy link
Collaborator

@antoine-de antoine-de commented Mar 17, 2022

POC to see if the ergonomics are ok or not

linked a bit to #116 (comment)

Remove Arc<Stop> in favor of Index<Stop> in StopTimes

This has the downside of needing the whole gtfs structure to access the stop's fields, but now we can have a mutable model easily.

let stop = gtfs.stops.get(stop_time.stop)?;

I'd like to try migrating a lib using gtfs_structures (maybe gtfs-to-geojson) to check this, but I open this draft to see if anyone has thoughts/ideas about this.

One down side of this is that I used https://gitlab.com/tekne/typed-generational-arena that is not very active (but it's so nice to have typed index 😻 )

@antoine-de
Copy link
Collaborator Author

after having given thought about this, I think the generational_area is overkill here, a typed index on a map would be enough and more convenient to use no ? I'll open a new draft with this I think

@antoine-de antoine-de force-pushed the generational_index branch 2 times, most recently from 2fbd059 to 627544e Compare March 23, 2022 15:21
POC to see if the ergonomics are ok or not
antoine-de added a commit that referenced this pull request Mar 23, 2022
Same as #123 but
without generational_indexes.

I think the indexes are really great for performance since:
* all structures are then `Vector` (great random access and cache friendly
iterations)
* the ids are short (integer vs string)

I don't think we need those performance in this crate though. Having
only typed index (a think wrapper over the real gtfs identifier) would
be more convenient I think.
It would:
* ease debug (easy to print the gtfs identifier, instead of having a
  meaningless integer)
* ease serialisation (same, we can serialize the string right away)
* be a more more close to the gtfs representation

This is still *very* early WIP, I'm not convinced at all by the
ergonomics, I'd like to keep the property of the Index in
#123 that the `Id`
have at least existed at one point (even if I don't plan to ensure this
if an object is deleted).
@antoine-de antoine-de changed the title Use Index<Stop> instead of Arc<Stop> Use Index<Stop> instead of Arc<Stop>: Id as integer Mar 23, 2022
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.

1 participant