What I’ve been working on for the last few days is breaking up routes.
You can think of a route as like a page in the transit schedule, it’s the thing that has a name like “bus 13″. I’ve been relying on that concept a lot internally. For instance, to list all the departures from a stop I first find all the routes that visit the stop and then I find the departures for each route.
The problem is that some of these routes are really big. For instance, all IC trains are listed as a single route: “IC”. That means that when I’m looking for trains that depart a station that gets visited by some IC train I have to look through all IC trains in the entire country. What I’ve been wanting to do is break up the really big routes into separate parts and that’s not too difficult if you look at a route on a map – but there’s more than 1000 routes so that would take way too long, I have to find a way to do it automatically. That’s what I’ve implemented over the last few days. What the video shows is first the big routes that were there before, and that now each of those big ones are made up of a number of smaller ones that have been determined by analyzing the trips that make up the route and grouping similar ones together. With this in place everything should now be a bit faster, and the slower a stop was before the greater an improvement it should see.
The next thing I’ll implement is related to performance too. Right now, to find departures at a particular time I have to take all trips for all days into consideration. I’d like to group trips such that to find a departures at some time you only have to look at the trips around that time. That should give a nice speedup too.
The reason I’m working on making the app faster is that I’d like to implement some operations that build on top of these, for instance departures from a set of stops to another set of stops rather than just from one to another. If the simple operations are slow the larger and more complex operations that I’d like to make will be suuuper slow. And I want those to be fast too.