[SERVER-2637] Optimize spheredist_rad function present in db/geo/core.h Created: 28/Feb/11  Updated: 12/Jul/16  Resolved: 14/Jan/13

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: 1.8.0-rc0
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Matteo Muratori Assignee: Unassigned
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 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)



 Comments   
Comment by hari.khalsa@10gen.com [ 14/Jan/13 ]

There is a new index type forthcoming, 2dsphere, that handles spherical indexing better.

Generated at Thu Feb 08 03:00:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.