paulmach / orb

Types and utilities for working with 2d geometry in Golang
MIT License
886 stars 103 forks source link

Degraded performance wkt.Unmarshal since v.0.9.1 #132

Closed doqtri closed 7 months ago

doqtri commented 1 year ago

Hi,

I've noticed the degraded performance of the method wkt.Unmarshal since v.0.9.1 Here is the comparison

v.0.9.0

BenchmarkUnmarshall_V90-10
BenchmarkUnmarshall_V90-10         55581         21352 ns/op       11384 B/op        101 allocs/op

v.0.9.1

BenchmarkUnmarshall_V91-10
BenchmarkUnmarshall_V91-10          9172        121703 ns/op       17722 B/op        180 allocs/op
paulmach commented 1 year ago

looks like

and then

There were a few issues about validation that these addressed. PRs welcome.

paulmach commented 7 months ago

performance has been improved to much greater than v0.9.0 levels in https://github.com/paulmach/orb/pull/142 See benchmarks in that PR.

The exception is very small geometries with multiple parts (multi*, polygon). The splitting of the parts still uses the regexp. However, in most cases the improvements to the "point parsing" will greatly out-way any issues.