-
-
Notifications
You must be signed in to change notification settings - Fork 353
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
Performance idea: squeezing down file size #746
Comments
Current stats on
and
Some fruit practically scrapes the ground. The contraction hierarchies are huge, but they're also probably not needed at all for this tool. We're not calculating lots of routes all the time. In fact, in the routing tool, I want to add a bunch of customization parameters for avoiding hills and busy roads -- and those're incompatible with CHs anyway, due to how slow rebuilding them would be. And large CHs slow down map edits. Dijkstra will serve us just fine. (We may want the CHs back for the travel demand model + mode shift analysis, but now sure how that'll work yet, and I don't think it's a main part of this tool.) |
I spoke quickly. It'll take more work to squish down pathfinding. Just switching to Making edits will takes 10.5s in huge_seattle; even without updating the CH node ordering, calculating the graphs and edge weights is quite slow in such a huge map. abstreet/map_model/src/pathfind/vehicles.rs Line 184 in 1c756be
|
…y to the bike network tool. #746 Just a modest start, switching from CHs to Dijkstra's for pathfinding. Not uploading the minified result yet.
Better... with just the bike Dijkstra graph, huge_seattle is down from 270MB originally to 170. The pathfinder is now only about 5MB, not 111MB. |
With just the bike graph, recalculating pathfinding down from 10s to 3ish. But that's still absurd! |
… rebuild the one graph we need. #746
… rebuild the one graph we need. #746
… rebuild the one graph we need. #746
…ds. #746 Somewhat invasive API change internal to map_model, but not much impact elsewhere. Not regenerating anything yet.
…ds. #746 Somewhat invasive API change internal to map_model, but not much impact elsewhere. Not regenerating anything yet.
…hem! #746 Regenerating everything...
…hem! #746 Regenerating everything...
…hem! #746 Regenerating everything...
…hem! #746 Regenerating everything...
Not sure if you already decided against using CHs here, but maybe here it would help to be able to just update the weights of an |
Luckily, #748 pretty much resolved this problem -- there was lots of redundant work happening when calculating the vehicle input graphs. Now this process is fast enough. I'm not sure updating the graph vs building from scratch would make much of a difference; the expensive thing is calculating each edge's weight. Also, this issue is about a newer side-project to create a bike network planning tool (previewable at abstreet.s3-website.us-east-2.amazonaws.com/0.2.58/abstreet.html?--ungap&system/us/seattle/maps/udistrict.bin). There's no traffic simulation, so the usage patterns for pathfinding are very different. I'm still exploring the idea, but possibly the user will have a few sliders where they can tune parameters that make bike routes avoid hills or avoid stressful roads. Only one or two routes would be calculated using these new weights. So probably, just Dijkstra's makes much more sense here. But that's not known for sure -- I might discretize the routing preferences into just a few options, after doing some of the parameter tuning myself and finding values that produce subjectively good routes in some example areas I know well. |
Pathfinding, including when editing the map, is now quite fast, even on the huge map. (One of the last perf bugs was actually unrelated to pathfinding, 9803558). Back to the original goal -- how much can we squeeze down As a baseline, 256MB filesize and about 9.5s on my fast machine to initially load. BuildingsAfter stripping out some of the CHs that aren't used for the bike tool and removing all buildings, 100MB and only 4.6s! Only 34MB when gzipped! There really are lots of buildings in the huge map. What do we really need them for in the bike net tool? Display (to give context to the map), routing (right now start and end points are buildings, but we could maybe relax that to just snap to intersections), and mode shift (the input path requests are in terms of buildings, which then map over to road positions). One idea I've been toying with is to "summarize" buildings in one block. Originally we have Not sure this is doable in the short-term, but it's an idea to hold onto. LanesOf the 4.5s to load the map in the previous section, 1.5s is building the quadtree! The number of lanes dominates easily -- about 5x the number of roads. We reorganized lanes to exist and be identified just as children of roads kind of recently, and it's much nicer code. But that change hasn't been done in the A quick test of what omitting the lanes from the quadtree would be like... yeah, 3.1s! The slow steps are then just deserializing the 100MB file and building the massive GeomBatch of unzoomed roads and intersections. This is totally worth doing in the short term. |
TurnsLet's get even crazier. Of the 100MB from the last section, intersections take half that space. Turns are nested underneath intersections now. Do we really need to save them? We recalculate them when we edit roads anyway, so... what if we didn't stash them in the file and just lazily calculated them? 60MB file, 2.5s to load. 20MB gzipped. Wow! Optimizing for initial loading experience is important because of first impressions, but of course that has to be balanced with actually using the tool. How quickly would we need to fill out turns, and would it all happen at once (thus incurring a slow step shortly after initial load)? Really need to just try it out to know for sure, but I think the first time the user tries to route or quick-sketch, we'll need everything. LanesThere's similar redundancy with roads and lanes. We have the road center-line; we could lazily fill in lane center-lines from that, instead of serializing. |
by squeezing some start-up performance of huge maps. #746 Shaving at least 1 second off quadtree initialization in huge_seattle from this, no noticeable effects otherwise.
network tool reasonably on the web. #743, #746 I'm declaring the budget to be 20MB gzipped map files. - north and south seattle boundaries extended a bit - central seattle added - stripping out unused pathfinding data for walking and transit to squeeze down the size. avoiding crashes for empty pathfinding -- if you try to simulate a minified map, most trips will just fail
For the bike network tool, ultimately I'd like to work on and present some vision at a large scale -- like all of North or South Seattle (50-60MB right now, or 20 gzipped) or the whole area (270MB, or 100 compressed). The
Map
files are gigantic, but I have some ideas for paring this down and creating something smaller, containing less detail than what's needed for traffic simulation...The text was updated successfully, but these errors were encountered: