Comments (8)
It could be type instability too
Or an inneficient GeoInterface path
(nope its just LibGEOS)
from geometryops.jl.
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).
from geometryops.jl.
That's not time for copying points from C - it's mostly for allocating arrays in Julia, the yellow Array
from geometryops.jl.
That's not time for copying points from C - it's mostly for allocating arrays in Julia, the yellow
Array
That picture was the before state. The afterward profile is in the other issue in LibGEOS.
from geometryops.jl.
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 area
in the benchmark to use getpoint
with getgeom(linestring)
implemented in JuliaGeo/LibGEOS.jl#193.
See #36 for faster area and benchmarks
from geometryops.jl.
Also see:
JuliaGeo/LibGEOS.jl#196
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.
from geometryops.jl.
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.
from geometryops.jl.
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.
from geometryops.jl.
Related Issues (20)
- Test that all clipping methods respect target in all situations
- Centroid doesnt work with LibGEOS geoms HOT 1
- GO.tuples should return canonical geometry types HOT 1
- _buffer_error_hinter errors when calling buffer and LibGEOS is not loaded HOT 1
- Pass `exact` through from `intersection_points` to `_intersection_points`
- Rename all `Geodesic*` methods to `Geodesic`
- Broken code block in docs HOT 2
- Most of the Edit this page links in docs are broken HOT 1
- LazyPolygonWindingOrder HOT 2
- refactor all random functions to use `applyreduce` HOT 4
- python wrapper conversions should be easy HOT 1
- `rebuild` should use child geometries as the source of dimensional truth
- `isclockwise` for polygons HOT 1
- Things we can do with triangulation
- Polygonize example is broken HOT 5
- Don't load Offset arrays.jl in tests HOT 2
- Intersection bug: "Clipping tracing hit every point" when polygons are not closed HOT 7
- Quick way of rotating a polygon? HOT 7
- `difference` depends on order of polygons
- `enumerate(GI.getpoint(geom))` is not type inferred on polygons HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geometryops.jl.