Git Product home page Git Product logo

Comments (3)

rsned avatar rsned commented on May 26, 2024

from geo.

pshopper avatar pshopper commented on May 26, 2024

Slow time is just the time on the Query. NumEdges is 429636.

from geo.

rsned avatar rsned commented on May 26, 2024

OK, I tried it on a 5 million edge polygon, and the query took ~200 seconds to complete.

My guess is that the reason it's really slow with the large edge count is because so far, only the Brute Force implementation is done on it. See: https://github.com/golang/geo/blob/master/s2/edge_query.go#L466

It was the simplest of the code to port to get the code running

If you look at the original C++, the switch over point from brute force to optimized is set at ~100 edges.

https://github.com/google/s2geometry/blob/master/src/s2/s2closest_edge_query.cc#L46

Running the C++ benchmarks, optimized gains dramatically the larger the data inputs.

Benchmark             Time(ns) Optimized     Brute   Opt gain
-------------------------------------------------------------
BM_FindClosest<Fractal>/12          286        276     ~1x
BM_FindClosest<Fractal>/48          899        894     ~1x
BM_FindClosest<Fractal>/192        2077       3268     ~1.5x
BM_FindClosest<Fractal>/768        3679      12611     ~4x
BM_FindClosest<Fractal>/3k         6064      49593     ~8x
BM_FindClosest<Fractal>/12k        9068     195660    ~20x
BM_FindClosest<Fractal>/48k       12929     830409    ~60x
BM_FindClosest<Fractal>/192k      17310    3302094   ~190x
BM_FindClosest<Fractal>/768k      23289   13361211   ~575x
BM_FindClosest<Fractal>/3M        33153   58392773  ~1750x

So, while probably not quite as dramatic as the C++, the Go optimized implementation which should provide considerable savings once it's completed. I don't have a specific ETA on when it will be completed, but I am still working through the porting to get it completed.

from geo.

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.