Commit 71957ca
authored
Add fast path for single value in VALUES aggregator (#130510)
This change introduces a fast path for the VALUES aggregator in the
single-value case. For the first value seen in each group, we add it the
new big array without touching the hash. For subsequent values, if they
are the same as the current value, we skip them; if they differ, we
trigger the slow path and add them to the hash. This optimization speeds
up VALUES when the number of groups is large and most groups have only
one value.
Before:
```
Benchmark (dataType) (groups) Mode Cnt Score Error Units
ValuesAggregatorBenchmark.run BytesRef 1 avgt 3 177.756 ± 2.111 ms/op
ValuesAggregatorBenchmark.run BytesRef 1000 avgt 3 126.174 ± 0.431 ms/op
ValuesAggregatorBenchmark.run BytesRef 1000000 avgt 3 66920.144 ± 53588.490 ms/op
```
After:
```
Benchmark (dataType) (groups) Mode Cnt Score Error Units
ValuesAggregatorBenchmark.run BytesRef 1 avgt 3 180.269 ± 4.019 ms/op
ValuesAggregatorBenchmark.run BytesRef 1000 avgt 3 107.051 ± 3.149 ms/op
ValuesAggregatorBenchmark.run BytesRef 1000000 avgt 3 26277.863 ± 7214.319 ms/op
```1 parent 83b05c6 commit 71957ca
File tree
7 files changed
+1279
-961
lines changed- docs/changelog
- x-pack/plugin/esql/compute/src/main
- generated-src/org/elasticsearch/compute/aggregation
- java/org/elasticsearch/compute/aggregation
7 files changed
+1279
-961
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 199 additions & 166 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 192 additions & 135 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 200 additions & 142 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 200 additions & 142 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 192 additions & 135 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments