Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2637

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

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 1.8.0-rc0
    • Geo

    Description

      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)

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: