Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

quadtree: fix bad sort due to pointer allocation issue #115

Merged
merged 1 commit into from
Jan 5, 2023

Conversation

paulmach
Copy link
Owner

@paulmach paulmach commented Jan 5, 2023

Fixes #112

This was due to me being clever and trying to reuse some memory, but I was not that clever...

This does hurt the bench marks a bit, but I think it's because it's doing the right thing now

benchmark                         old ns/op     new ns/op     delta
BenchmarkRandomKNearest10-10      1587          1828          +15.19%
BenchmarkRandomKNearest100-10     12826         18354         +43.10%

benchmark                         old allocs     new allocs     delta
BenchmarkRandomKNearest10-10      14             3              -78.57%
BenchmarkRandomKNearest100-10     104            3              -97.12%

benchmark                         old bytes     new bytes     delta
BenchmarkRandomKNearest10-10      472           400           -15.25%
BenchmarkRandomKNearest100-10     3432          2800          -18.41%

Many thanks to @sapiens-sapide for the clean test case in #112

@paulmach paulmach merged commit 7f89869 into master Jan 5, 2023
@paulmach paulmach deleted the quadtree-fix branch January 5, 2023 23:54
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

quadtree KNearest search is fickle
1 participant