-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a fenwick tree to optimize prefix sums
This patch makes summary use the excellent fenwick package from https://github.com/yourbasic/fenwick to dramatically speed up Add() calls while adding a bounded cost to memory. benchmark old ns/op new ns/op delta BenchmarkAdd1-4 187 206 +10.16% BenchmarkAdd10-4 332 274 -17.47% BenchmarkAdd100-4 1092 325 -70.24% The tree creation could be faster, but profiling has shown that it doesn't seem to be that much of a problem (that's because `summary.setAt()` happens a *lot* more than `summary.Add()`)
- Loading branch information
Showing
3 changed files
with
31 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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