Skip to content

Conversation

KristofferC
Copy link
Owner

A long standing gripe for me has been that indices and distances are returned as standard nested Arrays. Typically, each inner array hold quite a small number of neighbors so it means that we allocate a large number of small arrays.

Using ArrayOfArrays, these are stored contigously in one large flat array instead.

The difference in allocations can be readily seen:

julia> input = rand(3, 10^6);

julia> tree = KDTree(rand(3, 10^6));

julia> @time knn(tree, input, 5);
  1.538003 seconds (2.00 M allocations: 221.253 MiB, 10.03% gc time)

julia> @time knn(tree, input, 5);
  1.489310 seconds (98 allocations: 189.884 MiB, 0.29% gc time)

@KristofferC KristofferC force-pushed the kc/aoa branch 2 times, most recently from 6d5edc2 to cb71f4c Compare June 13, 2024 11:35
@KristofferC
Copy link
Owner Author

@nanosoldier runtests()

@nanosoldier
Copy link

Update on PkgEvalJob 048c5a7 vs. bc645d1: Accepted

@nanosoldier
Copy link

Update on PkgEvalJob 048c5a7 vs. bc645d1: Running

@nanosoldier
Copy link

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

@KristofferC KristofferC mentioned this pull request Jun 17, 2024
13 tasks
@KristofferC KristofferC force-pushed the kc/aoa branch 5 times, most recently from 1748083 to 92766f7 Compare June 29, 2024 17:56
@KristofferC KristofferC mentioned this pull request Jul 9, 2025
@KristofferC KristofferC force-pushed the kc/aoa branch 2 times, most recently from 64944b1 to f34aa27 Compare July 11, 2025 17:37
…arrays

A long standing gripe for me has been that indices and distances are
returned as standard nested `Array`s. Typically, each inner array hold
quite a small number of neighbors so  it means that we allocate a large
number of small arrays.

Using ArrayOfArrays, these are stored contigously in one large flat
array instead.

The difference in allocations can be readily seen:

```julia
julia> input = rand(3, 10^6);

julia> tree = KDTree(rand(3, 10^6));

julia> @time knn(tree, input, 5);
  1.538003 seconds (2.00 M allocations: 221.253 MiB, 10.03% gc time)

julia> @time knn(tree, input, 5);
  1.489310 seconds (98 allocations: 189.884 MiB, 0.29% gc time)
```
@KristofferC
Copy link
Owner Author

@nanosoldier runtests()

@nanosoldier
Copy link

Update on PkgEvalJob b148fdd vs. 0d814ad: Accepted

@nanosoldier
Copy link

Update on PkgEvalJob b148fdd vs. 0d814ad: Running

@nanosoldier
Copy link

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Report summary

✖ Packages that failed

3 packages failed only on the current version.

  • Package is using an unknown package: 1 packages
  • Test duration exceeded the time limit: 2 packages

40 packages failed on the previous version too.

✔ Packages that passed tests

1 packages passed tests only on the current version.

  • Other: 1 packages

59 packages passed tests on the previous version too.

➖ Packages that were skipped altogether

19 packages were skipped on the previous version too.

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.

2 participants