Skip to content
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 improvements #30

Open
tomalrussell opened this issue Sep 3, 2021 · 0 comments
Open

Performance improvements #30

tomalrussell opened this issue Sep 3, 2021 · 0 comments

Comments

@tomalrussell
Copy link
Member

Opening an issue to keep a note of performance improvement ideas. Feel free to edit and add to this list:

  • record cell index and re-use to look up multiple raster values (see benchmark notes below)
  • push multi-geometry / DataFrame-type operations down to C++ implementation (accept Numpy/GeoSeries/GeometryArray?)

Rough benchmarking for ~570,000 edges, split to ~600,000 splits on ~1km² grid. (OpenStreetMap Bangladesh highways, only trunk to tertiary).

operation implementation time
Split to long GeoDataFrame snail.multi_intersections.split_linestrings 1min 13s ± 2.6 s
Look up cell index for splits splits.geometry.apply(lambda g: list(get_cell_indices(g, r.width, r.height, list(r.transform)))) 59.8 s ± 166 ms
Get raster values using cell index splits.cell_index.apply(lambda i: data[i[1], i[0]]) 364 ms ± 15.1 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant