Push down some expressions to Dict layout reader's cached values#8341
Conversation
Merging this PR will improve performance by 14.57%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | bitwise_not_vortex_buffer_mut[128] |
186.1 ns | 215.3 ns | -13.55% |
| ❌ | Simulation | bitwise_not_vortex_buffer_mut[1024] |
246.4 ns | 275.6 ns | -10.58% |
| ⚡ | Simulation | chunked_bool_canonical_into[(1000, 10)] |
35.6 µs | 20.5 µs | +73.13% |
| ⚡ | Simulation | chunked_varbinview_canonical_into[(1000, 10)] |
198.2 µs | 161.9 µs | +22.43% |
| ⚡ | Simulation | chunked_varbinview_into_canonical[(1000, 10)] |
213.2 µs | 177 µs | +20.46% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing myrrc/pushdown-dict (34d9915) with develop (31fda42)
Footnotes
-
10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Polar Signals Profiling ResultsLatest Run
Powered by Polar Signals Cloud |
Benchmarks: PolarSignals ProfilingVortex (geomean): 1.065x ➖ How to read Verdict and Engines
datafusion / vortex-file-compressed (1.065x ➖, 0↑ 3↓)
No file size changes detected. |
Benchmarks: FineWeb NVMeVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.019x ➖, 0↑ 1↓)
datafusion / vortex-compact (1.013x ➖, 0↑ 1↓)
datafusion / parquet (1.003x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed (1.026x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.992x ➖, 1↑ 0↓)
duckdb / parquet (1.011x ➖, 0↑ 0↓)
File Size Changes (1 files changed, +0.0% overall, 1↑ 0↓)
Totals:
|
Benchmarks: TPC-H SF=1 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.972x ➖, 0↑ 0↓)
datafusion / vortex-compact (0.875x ✅, 11↑ 0↓)
datafusion / parquet (0.970x ➖, 1↑ 1↓)
datafusion / arrow (0.802x ✅, 19↑ 0↓)
duckdb / vortex-file-compressed (0.919x ➖, 7↑ 0↓)
duckdb / vortex-compact (0.923x ➖, 5↑ 0↓)
duckdb / parquet (0.952x ➖, 1↑ 1↓)
duckdb / duckdb (0.952x ➖, 1↑ 0↓)
File Size Changes (9 files changed, +0.0% overall, 5↑ 4↓)
Totals:
|
Benchmarks: TPC-DS SF=1 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.997x ➖, 2↑ 0↓)
datafusion / vortex-compact (1.003x ➖, 1↑ 1↓)
datafusion / parquet (1.005x ➖, 3↑ 1↓)
duckdb / vortex-file-compressed (0.988x ➖, 5↑ 1↓)
duckdb / vortex-compact (1.002x ➖, 0↑ 1↓)
duckdb / parquet (0.996x ➖, 1↑ 1↓)
duckdb / duckdb (1.007x ➖, 0↑ 3↓)
File Size Changes (7 files changed, +0.0% overall, 4↑ 3↓)
Totals:
|
Benchmarks: FineWeb S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.996x ➖, 0↑ 1↓)
datafusion / vortex-compact (1.038x ➖, 1↑ 2↓)
datafusion / parquet (0.846x ➖, 2↑ 0↓)
duckdb / vortex-file-compressed (0.959x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.901x ➖, 0↑ 0↓)
duckdb / parquet (0.978x ➖, 0↑ 0↓)
|
Benchmarks: Statistical and Population GeneticsVerdict: No clear signal (low confidence) How to read Verdict and Engines
duckdb / vortex-file-compressed (1.022x ➖, 0↑ 0↓)
duckdb / vortex-compact (1.027x ➖, 0↑ 0↓)
duckdb / parquet (1.028x ➖, 0↑ 0↓)
File Size Changes (1 files changed, -0.0% overall, 0↑ 1↓)
Totals:
|
Benchmarks: Random AccessVortex (geomean): 0.959x ➖ How to read Verdict and Engines
unknown / unknown (1.012x ➖, 1↑ 1↓)
|
Benchmarks: TPC-H SF=10 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.065x ➖, 0↑ 0↓)
datafusion / vortex-compact (1.066x ➖, 0↑ 0↓)
datafusion / parquet (1.046x ➖, 0↑ 0↓)
datafusion / arrow (1.005x ➖, 2↑ 0↓)
duckdb / vortex-file-compressed (1.057x ➖, 0↑ 1↓)
duckdb / vortex-compact (1.043x ➖, 0↑ 0↓)
duckdb / parquet (1.031x ➖, 0↑ 0↓)
duckdb / duckdb (1.032x ➖, 0↑ 0↓)
File Size Changes (26 files changed, -0.0% overall, 14↑ 12↓)
Totals:
|
Benchmarks: Clickbench on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.891x ✅, 21↑ 0↓)
datafusion / parquet (0.866x ✅, 32↑ 0↓)
duckdb / vortex-file-compressed (0.980x ➖, 2↑ 0↓)
duckdb / parquet (0.975x ➖, 0↑ 0↓)
duckdb / duckdb (0.989x ➖, 1↑ 0↓)
File Size Changes (106 files changed, +0.0% overall, 51↑ 55↓)
Totals:
|
Benchmarks: TPC-H SF=1 on S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.828x ➖, 4↑ 1↓)
datafusion / vortex-compact (0.958x ➖, 6↑ 5↓)
datafusion / parquet (1.014x ➖, 2↑ 2↓)
duckdb / vortex-file-compressed (0.918x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.995x ➖, 1↑ 0↓)
duckdb / parquet (0.952x ➖, 0↑ 0↓)
|
Benchmarks: Appian on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.004x ➖, 0↑ 0↓)
datafusion / parquet (0.991x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed (1.006x ➖, 0↑ 0↓)
duckdb / parquet (0.998x ➖, 0↑ 0↓)
duckdb / duckdb (1.010x ➖, 0↑ 0↓)
File Size Changes (3 files changed, -0.0% overall, 1↑ 2↓)
Totals:
|
Benchmarks: CompressionVortex (geomean): 1.001x ➖ How to read Verdict and Engines
unknown / unknown (0.986x ➖, 9↑ 2↓)
|
Benchmarks: TPC-H SF=10 on S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.944x ➖, 2↑ 2↓)
datafusion / vortex-compact (0.983x ➖, 1↑ 1↓)
datafusion / parquet (0.956x ➖, 1↑ 2↓)
duckdb / vortex-file-compressed (0.864x ➖, 1↑ 0↓)
duckdb / vortex-compact (0.961x ➖, 0↑ 0↓)
duckdb / parquet (0.917x ➖, 0↑ 0↓)
|
e64f2a2 to
e70ceab
Compare
e70ceab to
c9ba352
Compare
c9ba352 to
ed16fc6
Compare
ed16fc6 to
293abda
Compare
78f31fd to
e47595d
Compare
e47595d to
31508f0
Compare
|
The implementation with annotations and packing is slower than the original I've proposed. On #8303 the difference is 150ms (my solution) vs 250-300ms (the solution you proposed with annotations). |
31508f0 to
095e6c7
Compare
|
Replacing values_eval with uncompressed values doesn't change the performance. |
|
For easier searching, the optimal solution is ed16fc6. I agree we can memoize references_root to avoid N^2, and use uncompressed values instead of values_eval(). |
095e6c7 to
34d9915
Compare
When we access values of Dict layout reader, it canonicalizes them and stores
them in a SharedArray. This means we always pay the cost of canonicalization
which in turn means we can't do #8310 .
In order to solve this issue, we need to apply some expressions to the values
array before canonicalizing it. However, we can't push down arbitrary
expressions as it may be beneficial to apply them over canonicalized array.
One example of such expressions is LIKE over a Dict array with few codes used.
Applying LIKE to whole values array is not beneficial.
This PR adds a hardcoded internal is_negative_cost estimation for expressions
that we want to push before canonicalization. A hint for these are expressions
which don't depend on individual input size. As an example, for every string,
len(string) doesn't read the string itself but reads the metadata and thus is
O(1) on individual input.
We don't push down fallible (like cast) or null sensitive (like IS NULL)
expressions as well because we want to propagate the errors at call site
rather than upfront.