• filipe oliveira's avatar
    GEOSEARCH BYBOX: Simplified haversine distance formula when longitude diff is 0 (#11579) · 5e02338e
    filipe oliveira authored
    This is take 2 of `GEOSEARCH BYBOX` optimizations based on haversine
    distance formula when longitude diff is 0.
    The first one was in #11535 .
    
    - Given longitude diff is 0 the asin(sqrt(a)) on the haversine is asin(sin(abs(u))).
    - arcsin(sin(x)) equal to x when x ∈[−𝜋/2,𝜋/2].
    - Given latitude is between [−𝜋/2,𝜋/2] we can simplifiy arcsin(sin(x)) to x.
    
    On the sample dataset with 60M datapoints, we've measured 55% increase
    in the achievable ops/sec.
    
    (cherry picked from commit e48ac075)
    5e02338e
geohash_helper.c 11.4 KB