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

Add benches w/ copy to geo geometry & encoding #37

Merged
merged 2 commits into from
Nov 27, 2024
Merged

Conversation

kylebarron
Copy link
Member

@kylebarron kylebarron commented Nov 27, 2024

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.
  • I ran cargo fmt

Previously the bench to parse was

This is 2.3x faster than shapely.wkb.loads, and 11x faster than shapely.wkb.dumps! There's probably a tiny bit of Python overhead on the shapely side (e.g. an extra full-buffer copy back to Python after GEOS has serialized the geometry to a buffer) but I expect this is still at least a little faster than GEOS.

parse big to geo        time:   [161.29 µs 161.83 µs 162.38 µs]
                        change: [-1.0724% -0.4549% +0.1358%] (p = 0.15 > 0.05)

encode big              time:   [49.969 µs 50.204 µs 50.437 µs]
from shapely import wkt, wkb

with open('big.wkt') as f:
    geom = wkt.load(f)

%timeit buf = wkb.dumps(geom)
# 547 μs ± 3.2 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

%timeit test = wkb.loads(buf)
# 369 μs ± 1.01 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

@kylebarron kylebarron changed the title Add bench with copy to geo geometry Add benches w/ copy to geo geometry & encoding Nov 27, 2024
@kylebarron kylebarron merged commit 35226e3 into main Nov 27, 2024
1 check passed
@kylebarron kylebarron deleted the kyle/bench-to-geo branch November 27, 2024 01:11
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

Successfully merging this pull request may close these issues.

1 participant