rust-transit / gtfs-structure

Read a GTFS file
MIT License
56 stars 32 forks source link

Implement hashing for many basic enums #164

Closed kylerchin closed 4 months ago

kylerchin commented 5 months ago

I don't have a use for implementing Hash for Trips or StopTimes yet, nor a good workaround for Option<f32> types.

I'm working on compression of schedules and I think at least the enums should implement hashing to allow direct comparison of time intervals. Most implementions of schedule parsers, such as Google Maps, likely do not store the entire dataset. I attempted to do that and it wound up being over 200 GB for the entire world. Implementations typically store the difference between each stop as an itinerary, and then trips are referenced via an offset to the itinerary. I can copy over the pickup and dropoff fields, and timepoint into my own struct and compute a hash of it, which becomes the Itinerary, then use it to match trip ids with a previous itinerary, along with an offset.

This paper describes it quite well: https://ad-publications.informatik.uni-freiburg.de/SIGSPATIAL_Frequency_based_Search_BBS_2014.pdf

Like my previous Clone pull request, this does increase compile time but is not a breaking change, nor does it worsen runtime.

Thank you so much once again, Kyler Chin

kylerchin commented 4 months ago

When will this be merged?

antoine-de commented 4 months ago

oups, sorry, forgot to merge, done