-
Notifications
You must be signed in to change notification settings - Fork 15
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
Filter by geometries by bbox #55
Comments
Per the title, one idea to solve the
This would lead to the vtzero handlers getting called twice, so there would be that added cost. But my hope/hunch is that this cost would be small and worth it. Thoughts? |
Hey @springmeyer just to confirm, were these run on master or dedupe branch? |
@mapsam - dedupe |
Two ideas here:
|
@joto - this sounds very interesting. Could you share a little more detail on how this could work? How would we be able to do these point detections without decoding the vtzero geometry twice? Are you saying that we could do these while doing the current decode somehow (perhaps within our geometry handler)? This feels a little bit similar to mapbox/mapnik-vector-tile#146 where, per geometry part/ring we would check if that ring was outside the bbox filter and then avoid adding it to the vector containing all rings. |
Yes, I had this same thought. Currently we don't need to carry through the geometry at all - we simply create each geometry in the loop and then discard. So, unless @mapsam anticipates needing to return the geometry to the user, we could potentially do this and save significant memory allocations. I presume we'd need to, however, templatize all the vector-tile 2.x functions to accept a custom geometry type that overrides the allocator? /cc @flippmoke - ideas on how this could be done? |
Nope! |
@springmeyer To do any of this you have to rid yourself of the convenience of the |
Might be relevant here : mapbox/vtcomposite#55 |
More bbox filtering applied in mapbox/vtcomposite#91 to vcomposite |
I ran the slowest/most intense benchmark (
query: all things - dense nine tiles
) on OS X usingnode bench/vtquery.bench.js --iterations 5000 --concurrency 1
and a patch to disable all other tests besidesquery: all things - dense nine tiles
. Then I profiled in Activity Monitor during the run.What I see is:
mapbox::vector_tile::extract_geometry
due to calls tonew
anddelete
(memory allocation and deallocation)mapbox::vector_tile::extract_geometry
which show in profiling as adelete
call insidemapbox::util::detail::variant_helper<mapbox::geometry::polygon ...
(which I think is themapbox::geometry_base
at https://github.com/mapbox/geometry.hpp/blob/96d350510c0e6738a903be40e8138c7305f3e33f/include/mapbox/geometry/geometry.hpp#L23)mapbox::geometry::algorithms::detail::closest_point
vtzero::layer::next_feature()
)My interpretation is that:
mapbox::geometry
objects is expensive due to memory allocation and deallocationAnd therefore our overwhelming bottleneck (where > 50% of the time is taken) is
mapbox::vector_tile::extract_geometry
(https://github.com/mapbox/vector-tile/blob/97d8b89fe635f117ce7de25790028a65d9ce5172/include/mapbox/vector_tile.hpp#L15)So, to reduce the latency of scenarios like this (large radius and multiple tiles) we'll need to speed up
mapbox::vector_tile::extract_geometry
.Profiling output: https://callgraph.herokuapp.com/76849341d35452543e35c504964dcb94#thread-6
/cc @mapsam @flippmoke
The text was updated successfully, but these errors were encountered: