Open emiltin opened 7 years ago
@emiltin yep the idea came up during discussion, too. Basically the idea is to pull out a list of tags from Lua into C++ and then do the fast tag comparison on the C++ side already. @danpat and @joto found the approach in #4147 to be sufficient for a first try and easy to implement.
There are definitely some more speedups to be had with this general approach, but the improvements will be less significant than the tagless node filtering. I noted some other experiments I did here https://github.com/Project-OSRM/osrm-backend/pull/4147#issuecomment-308047549
Basically, for the planet we have 4.6 billion nodes, only 180 million of which have any tags. That's ~4.3 billion node_function
calls we can avoid. In comparison, doing tag checking on the remaining nodes or ways will reduce the call count by a few million, a much less significant saving, and the tag check itself is not completely free. I did some hard-coded testing and I saw ~8-10% speedups by filtering out way tags like buildings
or checking for access/highway
on nodes.
It's worth keeping this ticket though, I think it's generally a decent further optimization.
yes, it would be a smaller gain
inspired by #4147, what about the profile providing a list of tags, and only calling the node function if at least one of the tags are present? the node functions typically look at a limited number of tags. e.g. the car profile:
which only looks at the tags: access, vehicle, motor-vehicle,vehicle, barrier, bollard, highway if none of these tags are present, there's no need to call the node function.