-
Notifications
You must be signed in to change notification settings - Fork 4
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
Area LibGEOS Polygon problems #32
Comments
It could be type instability too Or an inneficient GeoInterface path (nope its just LibGEOS) |
This was runtime dispatch on GeoInterface.x and y. Solved by JuliaGeo/LibGEOS.jl#191, which brings the benchmark to 4μs for me (still slow, but it's copying points from C, so expected). |
That's not time for copying points from C - it's mostly for allocating arrays in Julia, the yellow |
That picture was the before state. The afterward profile is in the other issue in LibGEOS. |
Ok right, I think there are still a bunch of allocations happening though when each point is loaded. I can get it 7x faster changing See #36 for faster area and benchmarks |
Also see: Turns out most of the time is making clones. Without them we are down to: julia> @benchmark GO.area($pLG)
BenchmarkTools.Trial: 10000 samples with 337 evaluations.
Range (min … max): 256.193 ns … 10.465 μs ┊ GC (min … max): 0.00% … 96.32%
Time (median): 260.564 ns ┊ GC (median): 0.00%
Time (mean ± σ): 277.483 ns ± 167.507 ns ┊ GC (mean ± σ): 1.02% ± 1.67%
▅█▄▅▄▄▃▂▁ ▁ ▂▁ ▂ ▁▃ ▂▁ ▂
████████████▇▇██▇█▇█████▇▆██████▇▇█▇▅▅▇▇▃▅▄▇▃▃▄▃▆▃▁▁▃▇▃▁▁▄▄▅▅ █
256 ns Histogram: log(frequency) by time 418 ns <
Memory estimate: 48 bytes, allocs estimate: 2. |
With some fixes to context: julia> @benchmark GO.area($pLG)
BenchmarkTools.Trial: 10000 samples with 535 evaluations.
Range (min … max): 210.733 ns … 6.821 μs ┊ GC (min … max): 0.00% … 96.09%
Time (median): 213.314 ns ┊ GC (median): 0.00%
Time (mean ± σ): 220.193 ns ± 135.810 ns ┊ GC (mean ± σ): 1.36% ± 2.14%
▄██▄▂▃▄▁ ▁▁ ▂ ▁ ▂
████████▇████▇▅▆▅▆▆▅▆▅▅▄▅▆▅▅▃▃▅▅▁▁▃▅█▇▄▁▃▅█▇▄▁▅▃██▇▁▄▅▄██▅▁▁▄ █
211 ns Histogram: log(frequency) by time 284 ns <
Memory estimate: 48 bytes, allocs estimate: 2. |
And fixing how we get points a bit more: julia> @benchmark GO.area($pLG)
BenchmarkTools.Trial: 10000 samples with 870 evaluations.
Range (min … max): 128.115 ns … 4.316 μs ┊ GC (min … max): 0.00% … 95.92%
Time (median): 130.037 ns ┊ GC (median): 0.00%
Time (mean ± σ): 138.450 ns ± 117.333 ns ┊ GC (mean ± σ): 2.64% ± 3.03%
▅█▆▃▅▄ ▃▃▁▁▃▃ ▁ ▁
█████████████▇▆▆▆▆▆▇▇▇█▇▇▆▇▇▇▇▇▇▅▅▅▄▅▇▆▅▅▅██▅▅▆███▅▆▆▇▇▆▃▃▂▃▆ █
128 ns Histogram: log(frequency) by time 185 ns <
Memory estimate: 64 bytes, allocs estimate: 3. So under 4x using LibGEOS directly is possible. |
I think the LibGEOS memory leak is causing havok far and wide. I was just doing some quick benchmarks on the new
area
code and just about had a heart attack. I was using this polygon:I got the following:
So it seems like the method itself isn't bad, but it does NOT play nice with LibGEOS.
The text was updated successfully, but these errors were encountered: