Today ruffly 1/3 of the time spent in the routing() search (worker route()) is spent searching for trips. The data structure is not optimal and can be optimized/simplified for the purpose.
Current Model
The model looks more or less like this:
But this is not how the data is accessed, restructuring them would improve the performance and simplify the code:
Stop
+-> * Pattern
- * trip ids/indexes/refs
+-> * PatternStop <-- Name is up for discussion
- stop index/id/ref
+-> * StopVisit <-- Name is up for discussion
- arrival
- departure
Also if we could duplicate the structure for every service day (next N supported days) and only have scheduled trips for that particular day.
Then we could get rid of the following call - witch is done to check if a trip is running - this check is done for every trip we try to board:
Today ruffly 1/3 of the time spent in the routing() search (worker route()) is spent searching for trips. The data structure is not optimal and can be optimized/simplified for the purpose.
Current Model The model looks more or less like this:
But this is not how the data is accessed, restructuring them would improve the performance and simplify the code:
Also if we could duplicate the structure for every service day (next N supported days) and only have scheduled trips for that particular day. Then we could get rid of the following call - witch is done to check if a trip is running - this check is done for every trip we try to board:
Keeping trips de-normalized pr day will also simplify realtime updates, because only today and tomorrow is likely to be affected by the updates.