Skip to content

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

Merged
paulmach merged 1 commit intomasterfrom
quadtree-fix
Jan 5, 2023
Merged

quadtree: fix bad sort due to pointer allocation issue#115
paulmach merged 1 commit intomasterfrom
quadtree-fix

Conversation

@paulmach
Copy link
Copy Markdown
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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