georust / geozero

Zero-Copy reading and writing of geospatial data.
Apache License 2.0
321 stars 30 forks source link

change `Wkb` to non-owning #171

Closed kylebarron closed 10 months ago

kylebarron commented 10 months ago

I was doing some perf testing on Wkb parsing and this is slightly faster when you already have something else owning bytes. I did some perf benchmarking in geoarrow, and it looks like this is almost 4% faster when you don't need to make the copy, see https://github.com/kylebarron/geoarrow-rs/pull/186

before:

parse WKBArray to Vec<geo::Geometry>
                        time:   [39.945 ms 39.977 ms 40.009 ms]
                        change: [-0.4809% -0.3544% -0.2385%] (p = 0.00 < 0.05)
                        Change within noise threshold.

after:

parse WKBArray to Vec<geo::Geometry>
                        time:   [38.343 ms 38.508 ms 38.686 ms]
                        change: [-4.0973% -3.6748% -3.2766%] (p = 0.00 < 0.05)
                        Performance has improved.

I guess this is technically not a breaking change? Because Vec<u8> also implements AsRef<[u8]>?