Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Added vectorized aggregates #67

Merged
merged 1 commit into from
Jun 8, 2022
Merged

Added vectorized aggregates #67

merged 1 commit into from
Jun 8, 2022

Conversation

kelindar
Copy link
Owner

@kelindar kelindar commented Jun 8, 2022

This PR adds vectorized aggregates for Sum(), Avg(), Min() and Max(). Most of the magic is in bitmap and simd packages respectively.

Here are some benchmarks, sum is essentially a fully populated transaction (no filtering) and avg and max are calculated after an index (partial aggregates).

cpu: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
BenchmarkCollection/sum-8                  89768             13822 ns/op              65 B/op          0 allocs/op
BenchmarkCollection/avg-8                  41806             28669 ns/op             124 B/op          0 allocs/op
BenchmarkCollection/max-8                  41257             28582 ns/op             131 B/op          0 allocs/op

Here what sum benchmark looked prior to this, ~40x improvement under optimal conditions (no filter) and ~1.4x improvement when aggregating over a filtered column which does not have contiguous blocks.

cpu: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
BenchmarkCollection/sum-8                   2264            553207 ns/op            2322 B/op          1 allocs/op
BenchmarkCollection/avg-8                  29355             40862 ns/op             177 B/op          0 allocs/op

Note that it doesn't support ARM64 (e,g. Apple M1/M2) yet, as I haven't generated the relevant vectorized SVE assembly code.

@kelindar kelindar merged commit c8f7b07 into main Jun 8, 2022
@kelindar kelindar deleted the vectoraggr branch June 8, 2022 21:00
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.

1 participant