-
Notifications
You must be signed in to change notification settings - Fork 173
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
traffic:Improve startup performance #822
Conversation
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Rerouting still has errors when messages are added (removing messages works as before). Freshly calculated routes (after the messages were received) look OK. |
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Rerouting works as of e2d9a74; the error was an incorrect negation. However, freshly calculated messages now seem to have issues. Exports work. |
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Freshly calculated messages work as well as of ee59ece. |
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
And the latest batch of updates also fixes the two bugs and limitations:
The only open point is that restoring segmented ways currently does not work—segmented ways have to be regenerated from scratch. This would only be an issue with exotic use cases (binfiles from the map download server do not have segmented ways), and would only negate performance benefits introduces by these commits but not impact accuracy of data. Tested in the lab but not in real-life use cases yet. |
Signed-off-by: mvglasow <michael -at- vonglasow.com>
A brief test on a real device with real traffic messages looked OK. I will likely be making some heavy use of the new features over the course of the next week and then report back. |
Signed-off-by: mvglasow <michael -at- vonglasow.com>
I did a test under real-world conditions today:
Startup and route calculation were still quite slow, which may be in part because restoring some 200–300 locations from cache is still quite time-consuming. It might in fact make sense to defer even restoring of items until a map area containing them is queried.
|
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Signed-off-by: mvglasow <michael -at- vonglasow.com>
The latest batch of commits defers restore operations until a rectangle possibly containing the items is queried. That speeds up startup and calculation of short routes; the performance penalty will only strike when calculating a long route in an area with a lot of traffic messages. Probably the best we can get without multithreading. I’ll do some more tests over the course of this week, but I am planning to merge if I don’t encounter any crashes—for a number of use cases this is already a massive performance improvement over what we had before. |
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Real-world performance for a route all across Poland was still disastrous; route calculation with expansion of some 300 items took several minutes. Iterating over the whole map set once for each item we restore turns out to be quite inefficient. The latest commit takes a different approach: parse everything, then iterate over the map and compare anything with matching IDs and mark items when a match is found. If all items are matched, use the data, else discard everything. In the lab, this has cut route calculation from 60 to 14 seconds (tested with a route from the Latvian-Lithuanian border to Hradec Králové, spanning most of Lithuania and Poland). |
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Ready for merge, except that CodeFactor is preventing me from doing an automatic merge… |
traffic:Improve startup performance
traffic:Improve startup performance
To address #815, this PR improves performance of the traffic module by deferring location expansion until the location is actually needed, speeding things up when we are starting up with a large number of cached messages or receiving a large feed.
On startup and when receiving a feed, items for the location are generated immediately only if we are currently routing and the rectangle for the location overlaps with the rectangle for the route, as these messages may influence the route.
Otherwise, when a map rectangle is opened on the traffic map, items are generated for locations whose rectangles overlap the queried rectangle.
When the traffic map is queried with a NULL selection (meaning everything should be retrieved), nothing is expanded and items are returned only for previously expanded locations. This is an experimental feature which became necessary since the traffic module occasionally queries its own map (all of which happens with a NULL pointer and would otherwise cause all locations to be expanded). If the current implementation is found to cause trouble, we would need to constrain these operations to a particular rectangle.
When TraFF messages are exported via Dbus, all messages are expanded as part of the operation—so the export can now take quite long when the message store holds a lot of unresolved messages.
This still needs to undergo some tests. Starting up with a large list of messages and dragging the map around works, but routing and export have not been tested yet.