Giter Site home page Giter Site logo

Comments (8)

rafaqz avatar rafaqz commented on August 21, 2024

It could be type instability too

Or an inneficient GeoInterface path

(nope its just LibGEOS)

from geometryops.jl.

evetion avatar evetion commented on August 21, 2024
Screenshot 2024-01-01 at 14 49 21

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.

rafaqz avatar rafaqz commented on August 21, 2024

That's not time for copying points from C - it's mostly for allocating arrays in Julia, the yellow Array

from geometryops.jl.

evetion avatar evetion commented on August 21, 2024

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.

rafaqz avatar rafaqz commented on August 21, 2024

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.

rafaqz avatar rafaqz commented on August 21, 2024

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.

rafaqz avatar rafaqz commented on August 21, 2024

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.

rafaqz avatar rafaqz commented on August 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.