GEOSEARCH BYBOX: Simplified haversine distance formula when longitude diff is 0#11579
Merged
oranagra merged 3 commits intoredis:unstablefrom Dec 5, 2022
Merged
Conversation
…ormula when longitude diff is 0
oranagra
reviewed
Dec 5, 2022
oranagra
approved these changes
Dec 5, 2022
Merged
oranagra
pushed a commit
that referenced
this pull request
Dec 12, 2022
… diff is 0 (#11579) 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 e48ac07)
madolson
pushed a commit
to madolson/redis
that referenced
this pull request
Apr 19, 2023
… diff is 0 (redis#11579) This is take 2 of `GEOSEARCH BYBOX` optimizations based on haversine distance formula when longitude diff is 0. The first one was in redis#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.
enjoy-binbin
pushed a commit
to enjoy-binbin/redis
that referenced
this pull request
Jul 31, 2023
… diff is 0 (redis#11579) This is take 2 of `GEOSEARCH BYBOX` optimizations based on haversine distance formula when longitude diff is 0. The first one was in redis#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.
Contributor
|
@filipecosta90 Hi, I run the same benchmark with Redis7.4, the ops is only 25% of yours. I suspect that my cpu or gcc maybe too old, could you give some additional information about your hard/soft platform? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is take 2 of
GEOSEARCH BYBOXoptimizations based on haversine distance formula when longitude diff is 0. The first one was in #11535 .To test it we can simply focus on the geo.tcl
Notice that this logic is covered/tested in the "GEOSEARCH box edges fuzzy test" scenario.
On the sample dataset with 60M datapoints, we've measured 55% increase in the achievable ops/sec.
We can benchmark this improvement using the following dataset with 60M datapoints on the GEO key. https://s3.us-east-2.amazonaws.com/redis.benchmarks.spec/datasets/geopoint/dump.rdb
and command:
unstable ( 61c85a2 )
This PR