Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cheap ST_Intersection method for certain cases
To find the intersection of an envelope that contains a geometry, we can simple return the geometry. This adds a check for that case, short-circuiting the expensive intersection logic. It reduces the benchmark cost for these types of intersections with small polygons by 200x, and large polygons by 100,000x. Original Benchmark Mode Cnt Score Error Units **BenchmarkSTIntersection.stIntersectionComplexPolygonLargeEnvelope avgt 15 11572.428 ± 298.935 us/op** BenchmarkSTIntersection.stIntersectionComplexPolygonSmallEnvelope avgt 15 1405.820 ± 50.947 us/op BenchmarkSTIntersection.stIntersectionComplexPolygons avgt 15 18024.312 ± 93.407 us/op BenchmarkSTIntersection.stIntersectionSimpleComplexPolygons avgt 15 3624.582 ± 54.135 us/op **BenchmarkSTIntersection.stIntersectionSimplePolygonLargeEnvelope avgt 15 23.695 ± 0.296 us/op** BenchmarkSTIntersection.stIntersectionSimplePolygonSmallEnvelope avgt 15 47.711 ± 0.757 us/op BenchmarkSTIntersection.stIntersectionSimplePolygons avgt 15 17.121 ± 0.290 us/op With Envelope Shortcut Benchmark Mode Cnt Score Error Units **BenchmarkSTIntersection.stIntersectionComplexPolygonLargeEnvelope avgt 15 0.090 ± 0.007 us/op** BenchmarkSTIntersection.stIntersectionComplexPolygonSmallEnvelope avgt 15 1426.323 ± 52.648 us/op BenchmarkSTIntersection.stIntersectionComplexPolygons avgt 15 18471.559 ± 410.481 us/op BenchmarkSTIntersection.stIntersectionSimpleComplexPolygons avgt 15 3722.377 ± 67.931 us/op **BenchmarkSTIntersection.stIntersectionSimplePolygonLargeEnvelope avgt 15 0.087 ± 0.001 us/op** BenchmarkSTIntersection.stIntersectionSimplePolygonSmallEnvelope avgt 15 47.280 ± 0.524 us/op BenchmarkSTIntersection.stIntersectionSimplePolygons avgt 15 16.877 ± 0.364 us/op
- Loading branch information