Optimize spheredist_rad function present in db/geo/core.h

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.8.0-rc0
    • Component/s: Geo
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      https://github.com/mongodb/mongo/blob/master/db/geo/core.h

      The function spheredist_rad can be optimized in two ways:

      1) use a faster (but correct) formula: take a loook to http://www.movable-type.co.uk/scripts/latlong.html
      I would suggest the Spherical Law of Cosines, I've tested it and seems to work very well.

      2) then use a function that calculate sin and cos at the same time (saving in this way half of trigonometric functions): for example on x86/x86_64 there are several options (standard fsincos assembly function, SSE2 optimizations)

            Assignee:
            Unassigned
            Reporter:
            Matteo Muratori
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: