Skip to content

Optimize IN performance with specialized implementations#19390

Closed
geoffreyclaude wants to merge 11 commits into
apache:mainfrom
geoffreyclaude:perf/in_list_optims
Closed

Optimize IN performance with specialized implementations#19390
geoffreyclaude wants to merge 11 commits into
apache:mainfrom
geoffreyclaude:perf/in_list_optims

Conversation

@geoffreyclaude

@geoffreyclaude geoffreyclaude commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

Status

This aggregate PR has been superseded by the split stacked series for #19241.

The review path is now:

  1. IN LIST: clean up generic static filtering #21927: generic static-filter cleanup and fallback optimization
  2. IN LIST: add UInt8 bitmap filter #23011: Bitmap filter for UInt8
  3. IN LIST: add UInt16 bitmap filter #23012: Bitmap filter for UInt16
  4. IN LIST: reinterpret small-width types for bitmap filters #23013: zero-copy reinterpretation for 1-byte and 2-byte bitmap paths
  5. IN LIST: add branchless filter for small primitive lists #23014: branchless filter for small primitive lists
  6. IN LIST: add direct-probe hash filter for large primitive lists #23015: direct-probe hash filter for large primitive lists
  7. IN LIST: add string-view filters for Utf8View and BinaryView #23016: string-view filters for Utf8View and BinaryView
  8. IN LIST: add two-stage filter for Utf8 and LargeUtf8 #23017: two-stage filter for legacy Utf8 and LargeUtf8
  9. IN LIST: reinterpret FixedSizeBinary for primitive fast paths #23018: zero-copy reinterpretation for FixedSizeBinary

Each PR now owns one focused step in the optimization stack, with its own explanation and CI signal. Closing this aggregate PR avoids duplicate review on the same work.

#19241 remains the umbrella issue for the overall IN LIST performance work.

@github-actions github-actions Bot added the physical-expr Changes to the physical-expr crates label Dec 18, 2025
@geoffreyclaude

Copy link
Copy Markdown
Contributor Author

run benchmark in_list

@alamb-ghbot

Copy link
Copy Markdown

🤖 ./gh_compare_branch_bench.sh compare_branch_bench.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing perf/in_list_optims (f2a2503) to d68b629 diff
BENCH_NAME=in_list
BENCH_COMMAND=cargo bench --features=parquet --bench in_list
BENCH_FILTER=
BENCH_BRANCH_NAME=perf_in_list_optims
Results will be posted here when complete

@alamb-ghbot

Copy link
Copy Markdown

🤖: Benchmark completed

Details

group                                          main                                   perf_in_list_optims
-----                                          ----                                   -------------------
in_list/Float32/list=100/nulls=0%              1.55     58.7±0.39µs        ? ?/sec    1.00     37.9±0.89µs        ? ?/sec
in_list/Float32/list=100/nulls=20%             1.32     79.4±0.25µs        ? ?/sec    1.00     60.0±0.94µs        ? ?/sec
in_list/Float32/list=28/nulls=0%               1.28     51.1±0.31µs        ? ?/sec    1.00     39.9±0.91µs        ? ?/sec
in_list/Float32/list=28/nulls=20%              2.06     91.3±0.50µs        ? ?/sec    1.00     44.4±1.33µs        ? ?/sec
in_list/Float32/list=3/nulls=0%                6.60     41.9±0.74µs        ? ?/sec    1.00      6.4±0.03µs        ? ?/sec
in_list/Float32/list=3/nulls=20%               6.32     42.0±0.87µs        ? ?/sec    1.00      6.6±0.48µs        ? ?/sec
in_list/Float32/list=8/nulls=0%                4.25     49.1±0.40µs        ? ?/sec    1.00     11.6±0.06µs        ? ?/sec
in_list/Float32/list=8/nulls=20%               5.39     63.7±0.30µs        ? ?/sec    1.00     11.8±0.31µs        ? ?/sec
in_list/Int16/list=100/nulls=0%                6.17     49.6±0.21µs        ? ?/sec    1.00      8.0±0.03µs        ? ?/sec
in_list/Int16/list=100/nulls=20%               7.18     59.3±1.53µs        ? ?/sec    1.00      8.3±0.14µs        ? ?/sec
in_list/Int16/list=28/nulls=0%                 9.06     72.7±0.59µs        ? ?/sec    1.00      8.0±0.06µs        ? ?/sec
in_list/Int16/list=28/nulls=20%                5.98     49.1±0.18µs        ? ?/sec    1.00      8.2±0.03µs        ? ?/sec
in_list/Int16/list=3/nulls=0%                  4.81     38.5±1.10µs        ? ?/sec    1.00      8.0±0.06µs        ? ?/sec
in_list/Int16/list=3/nulls=20%                 4.58     37.8±0.74µs        ? ?/sec    1.00      8.2±0.04µs        ? ?/sec
in_list/Int16/list=8/nulls=0%                  5.38     43.6±0.59µs        ? ?/sec    1.00      8.1±0.20µs        ? ?/sec
in_list/Int16/list=8/nulls=20%                 5.06     41.7±1.25µs        ? ?/sec    1.00      8.2±0.07µs        ? ?/sec
in_list/Int32/list=100/nulls=0%                1.18     56.0±0.19µs        ? ?/sec    1.00     47.6±0.16µs        ? ?/sec
in_list/Int32/list=100/nulls=20%               1.02     66.1±0.30µs        ? ?/sec    1.00     65.1±0.56µs        ? ?/sec
in_list/Int32/list=28/nulls=0%                 1.15     83.2±0.27µs        ? ?/sec    1.00     72.6±2.27µs        ? ?/sec
in_list/Int32/list=28/nulls=20%                1.56     93.2±0.75µs        ? ?/sec    1.00     59.9±0.69µs        ? ?/sec
in_list/Int32/list=3/nulls=0%                  6.15     39.8±1.98µs        ? ?/sec    1.00      6.5±0.59µs        ? ?/sec
in_list/Int32/list=3/nulls=20%                 5.78     38.1±0.14µs        ? ?/sec    1.00      6.6±0.22µs        ? ?/sec
in_list/Int32/list=8/nulls=0%                  3.67     42.7±0.16µs        ? ?/sec    1.00     11.6±0.43µs        ? ?/sec
in_list/Int32/list=8/nulls=20%                 3.60     42.6±4.08µs        ? ?/sec    1.00     11.8±0.23µs        ? ?/sec
in_list/TimestampNs/list=100/nulls=0%          1.68    102.3±1.83µs        ? ?/sec    1.00     60.8±0.99µs        ? ?/sec
in_list/TimestampNs/list=100/nulls=20%         2.62    112.2±1.81µs        ? ?/sec    1.00     42.9±0.23µs        ? ?/sec
in_list/TimestampNs/list=28/nulls=0%           1.00     70.3±0.28µs        ? ?/sec    1.07     75.5±0.65µs        ? ?/sec
in_list/TimestampNs/list=28/nulls=20%          1.16   110.9±11.14µs        ? ?/sec    1.00     96.0±0.87µs        ? ?/sec
in_list/TimestampNs/list=3/nulls=0%            5.42     53.4±0.90µs        ? ?/sec    1.00      9.9±0.03µs        ? ?/sec
in_list/TimestampNs/list=3/nulls=20%           9.10     91.9±0.39µs        ? ?/sec    1.00     10.1±0.09µs        ? ?/sec
in_list/TimestampNs/list=8/nulls=0%            2.25     58.0±2.34µs        ? ?/sec    1.00     25.8±0.40µs        ? ?/sec
in_list/TimestampNs/list=8/nulls=20%           3.58     94.9±2.67µs        ? ?/sec    1.00     26.5±1.93µs        ? ?/sec
in_list/UInt8/list=100/nulls=0%                8.38     66.1±0.40µs        ? ?/sec    1.00      7.9±0.08µs        ? ?/sec
in_list/UInt8/list=100/nulls=20%               9.50     76.9±0.95µs        ? ?/sec    1.00      8.1±0.03µs        ? ?/sec
in_list/UInt8/list=28/nulls=0%                 7.72     60.9±1.21µs        ? ?/sec    1.00      7.9±0.04µs        ? ?/sec
in_list/UInt8/list=28/nulls=20%                6.03     48.6±0.35µs        ? ?/sec    1.00      8.1±0.06µs        ? ?/sec
in_list/UInt8/list=3/nulls=0%                  4.79     37.9±2.02µs        ? ?/sec    1.00      7.9±0.21µs        ? ?/sec
in_list/UInt8/list=3/nulls=20%                 4.67     37.7±0.93µs        ? ?/sec    1.00      8.1±0.09µs        ? ?/sec
in_list/UInt8/list=8/nulls=0%                  5.47     43.1±0.53µs        ? ?/sec    1.00      7.9±0.04µs        ? ?/sec
in_list/UInt8/list=8/nulls=20%                 5.34     43.2±0.40µs        ? ?/sec    1.00      8.1±0.13µs        ? ?/sec
in_list/Utf8/list=100/nulls=0%/str=100         1.05    157.8±1.59µs        ? ?/sec    1.00    150.2±3.55µs        ? ?/sec
in_list/Utf8/list=100/nulls=0%/str=12          1.03     89.2±1.29µs        ? ?/sec    1.00     87.0±0.29µs        ? ?/sec
in_list/Utf8/list=100/nulls=0%/str=3           1.00    105.5±2.55µs        ? ?/sec    1.18    124.6±3.80µs        ? ?/sec
in_list/Utf8/list=100/nulls=20%/str=100        1.07    183.6±3.33µs        ? ?/sec    1.00    171.0±2.87µs        ? ?/sec
in_list/Utf8/list=100/nulls=20%/str=12         1.06    138.2±0.84µs        ? ?/sec    1.00    130.4±3.51µs        ? ?/sec
in_list/Utf8/list=100/nulls=20%/str=3          1.00    132.9±1.93µs        ? ?/sec    1.08    143.9±4.00µs        ? ?/sec
in_list/Utf8/list=28/nulls=0%/str=100          1.05    141.2±3.41µs        ? ?/sec    1.00    134.4±2.19µs        ? ?/sec
in_list/Utf8/list=28/nulls=0%/str=12           1.07     81.4±1.31µs        ? ?/sec    1.00     76.4±1.57µs        ? ?/sec
in_list/Utf8/list=28/nulls=0%/str=3            1.00     89.1±0.49µs        ? ?/sec    1.04     92.5±0.35µs        ? ?/sec
in_list/Utf8/list=28/nulls=20%/str=100         1.02    172.1±3.29µs        ? ?/sec    1.00    169.3±6.31µs        ? ?/sec
in_list/Utf8/list=28/nulls=20%/str=12          1.00    131.1±2.17µs        ? ?/sec    1.18    154.9±2.66µs        ? ?/sec
in_list/Utf8/list=28/nulls=20%/str=3           1.00    146.5±2.48µs        ? ?/sec    1.06    154.6±1.30µs        ? ?/sec
in_list/Utf8/list=3/nulls=0%/str=100           1.06    128.9±2.08µs        ? ?/sec    1.00    121.7±0.54µs        ? ?/sec
in_list/Utf8/list=3/nulls=0%/str=12            1.10     71.5±5.86µs        ? ?/sec    1.00     65.3±0.30µs        ? ?/sec
in_list/Utf8/list=3/nulls=0%/str=3             1.03     71.8±1.00µs        ? ?/sec    1.00     69.8±1.49µs        ? ?/sec
in_list/Utf8/list=3/nulls=20%/str=100          1.00    154.8±3.95µs        ? ?/sec    1.00    155.1±1.14µs        ? ?/sec
in_list/Utf8/list=3/nulls=20%/str=12           1.00    109.4±0.45µs        ? ?/sec    1.01    110.8±0.62µs        ? ?/sec
in_list/Utf8/list=3/nulls=20%/str=3            1.00    111.6±3.55µs        ? ?/sec    1.03    115.5±0.72µs        ? ?/sec
in_list/Utf8/list=8/nulls=0%/str=100           1.09   138.7±15.15µs        ? ?/sec    1.00    127.0±1.18µs        ? ?/sec
in_list/Utf8/list=8/nulls=0%/str=12            1.04     75.4±0.93µs        ? ?/sec    1.00     72.2±9.40µs        ? ?/sec
in_list/Utf8/list=8/nulls=0%/str=3             1.05     78.0±0.44µs        ? ?/sec    1.00     74.3±0.40µs        ? ?/sec
in_list/Utf8/list=8/nulls=20%/str=100          1.00    158.9±6.78µs        ? ?/sec    1.01    160.4±4.45µs        ? ?/sec
in_list/Utf8/list=8/nulls=20%/str=12           1.00    114.1±0.59µs        ? ?/sec    1.02    116.2±0.88µs        ? ?/sec
in_list/Utf8/list=8/nulls=20%/str=3            1.00    116.8±5.02µs        ? ?/sec    1.03    119.9±0.31µs        ? ?/sec
in_list/Utf8View/list=100/nulls=0%/str=100     1.00    160.9±1.19µs        ? ?/sec    1.08   174.3±11.20µs        ? ?/sec
in_list/Utf8View/list=100/nulls=0%/str=12      1.18    117.1±0.67µs        ? ?/sec    1.00     99.3±1.42µs        ? ?/sec
in_list/Utf8View/list=100/nulls=0%/str=3       1.95    100.3±0.38µs        ? ?/sec    1.00     51.5±0.35µs        ? ?/sec
in_list/Utf8View/list=100/nulls=20%/str=100    1.00    192.6±1.37µs        ? ?/sec    1.04    200.0±0.69µs        ? ?/sec
in_list/Utf8View/list=100/nulls=20%/str=12     1.63    122.4±0.74µs        ? ?/sec    1.00     75.3±1.40µs        ? ?/sec
in_list/Utf8View/list=100/nulls=20%/str=3      1.76    134.0±0.42µs        ? ?/sec    1.00     76.1±0.36µs        ? ?/sec
in_list/Utf8View/list=28/nulls=0%/str=100      1.00    168.5±1.55µs        ? ?/sec    1.03    173.6±1.48µs        ? ?/sec
in_list/Utf8View/list=28/nulls=0%/str=12       1.17    113.7±3.69µs        ? ?/sec    1.00     97.2±1.03µs        ? ?/sec
in_list/Utf8View/list=28/nulls=0%/str=3        1.00     82.4±0.46µs        ? ?/sec    1.20     98.6±1.17µs        ? ?/sec
in_list/Utf8View/list=28/nulls=20%/str=100     1.00    213.4±5.15µs        ? ?/sec    1.03    219.0±1.54µs        ? ?/sec
in_list/Utf8View/list=28/nulls=20%/str=12      2.97    155.7±1.73µs        ? ?/sec    1.00     52.5±0.22µs        ? ?/sec
in_list/Utf8View/list=28/nulls=20%/str=3       1.64    126.9±0.91µs        ? ?/sec    1.00     77.5±0.58µs        ? ?/sec
in_list/Utf8View/list=3/nulls=0%/str=100       1.07    135.7±0.79µs        ? ?/sec    1.00    127.0±0.90µs        ? ?/sec
in_list/Utf8View/list=3/nulls=0%/str=12        4.50     69.5±0.40µs        ? ?/sec    1.00     15.4±0.05µs        ? ?/sec
in_list/Utf8View/list=3/nulls=0%/str=3         4.66     72.1±1.73µs        ? ?/sec    1.00     15.5±0.28µs        ? ?/sec
in_list/Utf8View/list=3/nulls=20%/str=100      1.00    165.7±1.41µs        ? ?/sec    1.00    165.5±7.06µs        ? ?/sec
in_list/Utf8View/list=3/nulls=20%/str=12       7.16    112.6±1.92µs        ? ?/sec    1.00     15.7±0.37µs        ? ?/sec
in_list/Utf8View/list=3/nulls=20%/str=3        7.43    116.8±2.24µs        ? ?/sec    1.00     15.7±0.44µs        ? ?/sec
in_list/Utf8View/list=8/nulls=0%/str=100       1.06    140.2±1.09µs        ? ?/sec    1.00    131.9±2.82µs        ? ?/sec
in_list/Utf8View/list=8/nulls=0%/str=12        1.58     75.8±7.92µs        ? ?/sec    1.00     48.0±0.81µs        ? ?/sec
in_list/Utf8View/list=8/nulls=0%/str=3         1.57     76.3±0.39µs        ? ?/sec    1.00     48.6±1.07µs        ? ?/sec
in_list/Utf8View/list=8/nulls=20%/str=100      1.00    167.3±0.90µs        ? ?/sec    1.01    168.7±3.47µs        ? ?/sec
in_list/Utf8View/list=8/nulls=20%/str=12       2.42    115.7±2.88µs        ? ?/sec    1.00     47.8±0.78µs        ? ?/sec
in_list/Utf8View/list=8/nulls=20%/str=3        2.51    119.5±0.58µs        ? ?/sec    1.00     47.6±0.85µs        ? ?/sec

Comment thread datafusion/physical-expr/src/expressions/in_list/array_filter.rs Outdated
Comment thread datafusion/physical-expr/src/expressions/in_list/array_filter.rs Outdated
@Dandandan

Copy link
Copy Markdown
Contributor

run benchmarks

@alamb-ghbot

Copy link
Copy Markdown

🤖 ./gh_compare_branch.sh gh_compare_branch.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing perf/in_list_optims (f2a2503) to d68b629 diff using: tpch_mem clickbench_partitioned clickbench_extended
Results will be posted here when complete

@Dandandan

Copy link
Copy Markdown
Contributor

run benchmark tpch tpchds

@alamb-ghbot

Copy link
Copy Markdown

🤖 Hi @Dandandan, thanks for the request (#19390 (comment)).

scrape_comments.py only supports whitelisted benchmarks.

  • Standard: clickbench_1, clickbench_extended, clickbench_partitioned, clickbench_pushdown, external_aggr, tpcds, tpch, tpch10, tpch_mem, tpch_mem10
  • Criterion: aggregate_query_sql, aggregate_vectorized, case_when, in_list, sql_planner, with_hashes

Please choose one or more of these with run benchmark <name> or run benchmark <name1> <name2>...
Unsupported benchmarks: tpchds.

@alamb-ghbot

Copy link
Copy Markdown

🤖: Benchmark completed

Details

Comparing HEAD and perf_in_list_optims
--------------------
Benchmark clickbench_extended.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃        HEAD ┃ perf_in_list_optims ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │  2725.42 ms │          2806.89 ms │     no change │
│ QQuery 1     │  1205.55 ms │          1296.98 ms │  1.08x slower │
│ QQuery 2     │  2354.44 ms │          2501.12 ms │  1.06x slower │
│ QQuery 3     │  1158.78 ms │          1208.21 ms │     no change │
│ QQuery 4     │  2343.44 ms │          2328.86 ms │     no change │
│ QQuery 5     │ 29573.83 ms │         29313.99 ms │     no change │
│ QQuery 6     │  3988.57 ms │          4081.38 ms │     no change │
│ QQuery 7     │  3894.61 ms │          3628.87 ms │ +1.07x faster │
└──────────────┴─────────────┴─────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                  ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                  │ 47244.63ms │
│ Total Time (perf_in_list_optims)   │ 47166.29ms │
│ Average Time (HEAD)                │  5905.58ms │
│ Average Time (perf_in_list_optims) │  5895.79ms │
│ Queries Faster                     │          1 │
│ Queries Slower                     │          2 │
│ Queries with No Change             │          5 │
│ Queries with Failure               │          0 │
└────────────────────────────────────┴────────────┘
--------------------
Benchmark clickbench_partitioned.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃        HEAD ┃ perf_in_list_optims ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │     2.37 ms │             2.26 ms │     no change │
│ QQuery 1     │    52.91 ms │            51.62 ms │     no change │
│ QQuery 2     │   137.22 ms │           136.97 ms │     no change │
│ QQuery 3     │   157.06 ms │           160.07 ms │     no change │
│ QQuery 4     │  1179.83 ms │          1152.00 ms │     no change │
│ QQuery 5     │  1560.36 ms │          1540.33 ms │     no change │
│ QQuery 6     │     2.15 ms │             2.17 ms │     no change │
│ QQuery 7     │    56.53 ms │            56.82 ms │     no change │
│ QQuery 8     │  1509.57 ms │          1477.40 ms │     no change │
│ QQuery 9     │  1967.08 ms │          1895.92 ms │     no change │
│ QQuery 10    │   364.36 ms │           378.01 ms │     no change │
│ QQuery 11    │   423.25 ms │           433.69 ms │     no change │
│ QQuery 12    │  1475.13 ms │          1407.02 ms │     no change │
│ QQuery 13    │  2115.97 ms │          2059.29 ms │     no change │
│ QQuery 14    │  1363.18 ms │          1308.84 ms │     no change │
│ QQuery 15    │  1343.47 ms │          1261.13 ms │ +1.07x faster │
│ QQuery 16    │  2811.16 ms │          2756.23 ms │     no change │
│ QQuery 17    │  2778.01 ms │          2787.48 ms │     no change │
│ QQuery 18    │  5553.83 ms │          5159.05 ms │ +1.08x faster │
│ QQuery 19    │   125.28 ms │           125.76 ms │     no change │
│ QQuery 20    │  2052.66 ms │          1935.68 ms │ +1.06x faster │
│ QQuery 21    │  2324.36 ms │          2247.58 ms │     no change │
│ QQuery 22    │  3946.25 ms │          3838.61 ms │     no change │
│ QQuery 23    │ 16658.91 ms │         12406.56 ms │ +1.34x faster │
│ QQuery 24    │   227.66 ms │           221.15 ms │     no change │
│ QQuery 25    │   472.53 ms │           473.19 ms │     no change │
│ QQuery 26    │   239.05 ms │           219.07 ms │ +1.09x faster │
│ QQuery 27    │  2925.72 ms │          2766.22 ms │ +1.06x faster │
│ QQuery 28    │ 24656.05 ms │         23549.07 ms │     no change │
│ QQuery 29    │  1020.26 ms │           976.67 ms │     no change │
│ QQuery 30    │  1409.95 ms │          1338.93 ms │ +1.05x faster │
│ QQuery 31    │  1400.09 ms │          1337.21 ms │     no change │
│ QQuery 32    │  5774.13 ms │          5190.24 ms │ +1.11x faster │
│ QQuery 33    │  6407.01 ms │          6021.19 ms │ +1.06x faster │
│ QQuery 34    │  6500.51 ms │          6415.47 ms │     no change │
│ QQuery 35    │  2103.71 ms │          2017.51 ms │     no change │
│ QQuery 36    │    68.10 ms │            67.99 ms │     no change │
│ QQuery 37    │    47.03 ms │            48.20 ms │     no change │
│ QQuery 38    │    69.86 ms │            67.91 ms │     no change │
│ QQuery 39    │   106.08 ms │           105.06 ms │     no change │
│ QQuery 40    │    28.50 ms │            25.97 ms │ +1.10x faster │
│ QQuery 41    │    23.83 ms │            25.79 ms │  1.08x slower │
│ QQuery 42    │    21.20 ms │            21.21 ms │     no change │
└──────────────┴─────────────┴─────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ Benchmark Summary                  ┃             ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ Total Time (HEAD)                  │ 103462.18ms │
│ Total Time (perf_in_list_optims)   │  95468.54ms │
│ Average Time (HEAD)                │   2406.10ms │
│ Average Time (perf_in_list_optims) │   2220.20ms │
│ Queries Faster                     │          10 │
│ Queries Slower                     │           1 │
│ Queries with No Change             │          32 │
│ Queries with Failure               │           0 │
└────────────────────────────────────┴─────────────┘
--------------------
Benchmark tpch_mem_sf1.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃      HEAD ┃ perf_in_list_optims ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1     │ 139.03 ms │           133.34 ms │     no change │
│ QQuery 2     │  28.29 ms │            30.88 ms │  1.09x slower │
│ QQuery 3     │  39.30 ms │            40.03 ms │     no change │
│ QQuery 4     │  29.65 ms │            29.76 ms │     no change │
│ QQuery 5     │  91.43 ms │            91.82 ms │     no change │
│ QQuery 6     │  20.10 ms │            20.37 ms │     no change │
│ QQuery 7     │ 243.33 ms │           246.44 ms │     no change │
│ QQuery 8     │  38.65 ms │            38.74 ms │     no change │
│ QQuery 9     │ 107.49 ms │           114.95 ms │  1.07x slower │
│ QQuery 10    │  66.38 ms │            67.41 ms │     no change │
│ QQuery 11    │  19.47 ms │            18.27 ms │ +1.07x faster │
│ QQuery 12    │  52.22 ms │            53.28 ms │     no change │
│ QQuery 13    │  50.39 ms │            51.38 ms │     no change │
│ QQuery 14    │  14.71 ms │            14.23 ms │     no change │
│ QQuery 15    │  26.27 ms │            25.97 ms │     no change │
│ QQuery 16    │  25.28 ms │            25.64 ms │     no change │
│ QQuery 17    │ 165.92 ms │           168.99 ms │     no change │
│ QQuery 18    │ 294.08 ms │           294.12 ms │     no change │
│ QQuery 19    │  39.69 ms │            38.75 ms │     no change │
│ QQuery 20    │  51.17 ms │            51.39 ms │     no change │
│ QQuery 21    │ 345.46 ms │           341.94 ms │     no change │
│ QQuery 22    │  18.11 ms │            17.48 ms │     no change │
└──────────────┴───────────┴─────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                  ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                  │ 1906.43ms │
│ Total Time (perf_in_list_optims)   │ 1915.18ms │
│ Average Time (HEAD)                │   86.66ms │
│ Average Time (perf_in_list_optims) │   87.05ms │
│ Queries Faster                     │         1 │
│ Queries Slower                     │         2 │
│ Queries with No Change             │        19 │
│ Queries with Failure               │         0 │
└────────────────────────────────────┴───────────┘

@Dandandan

Copy link
Copy Markdown
Contributor

run benchmark tpch tpcds

@alamb-ghbot

Copy link
Copy Markdown

🤖 ./gh_compare_branch.sh gh_compare_branch.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing perf/in_list_optims (f2a2503) to d68b629 diff using: tpch
Results will be posted here when complete

@alamb-ghbot

Copy link
Copy Markdown

🤖: Benchmark completed

Details

Comparing HEAD and perf_in_list_optims
--------------------
Benchmark tpch_sf1.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Query        ┃      HEAD ┃ perf_in_list_optims ┃    Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ QQuery 1     │ 231.35 ms │           223.32 ms │ no change │
│ QQuery 2     │ 101.95 ms │           100.61 ms │ no change │
│ QQuery 3     │ 130.96 ms │           131.08 ms │ no change │
│ QQuery 4     │  77.52 ms │            80.92 ms │ no change │
│ QQuery 5     │ 180.82 ms │           183.99 ms │ no change │
│ QQuery 6     │  66.39 ms │            68.45 ms │ no change │
│ QQuery 7     │ 221.26 ms │           225.37 ms │ no change │
│ QQuery 8     │ 169.39 ms │           169.80 ms │ no change │
│ QQuery 9     │ 234.35 ms │           233.20 ms │ no change │
│ QQuery 10    │ 191.96 ms │           191.30 ms │ no change │
│ QQuery 11    │  77.86 ms │            78.08 ms │ no change │
│ QQuery 12    │ 120.03 ms │           119.39 ms │ no change │
│ QQuery 13    │ 225.39 ms │           222.78 ms │ no change │
│ QQuery 14    │  99.23 ms │            97.40 ms │ no change │
│ QQuery 15    │ 124.72 ms │           126.19 ms │ no change │
│ QQuery 16    │  60.16 ms │            61.62 ms │ no change │
│ QQuery 17    │ 290.48 ms │           286.19 ms │ no change │
│ QQuery 18    │ 335.46 ms │           338.83 ms │ no change │
│ QQuery 19    │ 140.50 ms │           135.63 ms │ no change │
│ QQuery 20    │ 131.02 ms │           131.28 ms │ no change │
│ QQuery 21    │ 276.38 ms │           285.97 ms │ no change │
│ QQuery 22    │  43.92 ms │            44.97 ms │ no change │
└──────────────┴───────────┴─────────────────────┴───────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                  ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                  │ 3531.09ms │
│ Total Time (perf_in_list_optims)   │ 3536.36ms │
│ Average Time (HEAD)                │  160.50ms │
│ Average Time (perf_in_list_optims) │  160.74ms │
│ Queries Faster                     │         0 │
│ Queries Slower                     │         0 │
│ Queries with No Change             │        22 │
│ Queries with Failure               │         0 │
└────────────────────────────────────┴───────────┘

@alamb-ghbot

Copy link
Copy Markdown

🤖 ./gh_compare_branch.sh gh_compare_branch.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing perf/in_list_optims (f2a2503) to d68b629 diff using: tpcds
Results will be posted here when complete

@alamb-ghbot

Copy link
Copy Markdown

🤖: Benchmark completed

Details

Comparing HEAD and perf_in_list_optims
--------------------
Benchmark tpcds_sf1.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃        HEAD ┃ perf_in_list_optims ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1     │    62.81 ms │            63.40 ms │     no change │
│ QQuery 2     │   200.58 ms │           211.30 ms │  1.05x slower │
│ QQuery 3     │   157.02 ms │           161.27 ms │     no change │
│ QQuery 4     │  2147.68 ms │          2154.43 ms │     no change │
│ QQuery 5     │   266.90 ms │           272.12 ms │     no change │
│ QQuery 6     │  1608.53 ms │          1568.65 ms │     no change │
│ QQuery 7     │   516.14 ms │           516.20 ms │     no change │
│ QQuery 8     │   171.09 ms │           174.30 ms │     no change │
│ QQuery 9     │   279.10 ms │           278.52 ms │     no change │
│ QQuery 10    │   169.98 ms │           172.34 ms │     no change │
│ QQuery 11    │  1440.42 ms │          1456.00 ms │     no change │
│ QQuery 12    │    72.90 ms │            72.63 ms │     no change │
│ QQuery 13    │   569.65 ms │           573.00 ms │     no change │
│ QQuery 14    │  2058.14 ms │          2120.24 ms │     no change │
│ QQuery 15    │    27.41 ms │            29.18 ms │  1.06x slower │
│ QQuery 16    │    58.86 ms │            59.82 ms │     no change │
│ QQuery 17    │   356.40 ms │           360.71 ms │     no change │
│ QQuery 18    │   191.05 ms │           192.99 ms │     no change │
│ QQuery 19    │   228.87 ms │           231.37 ms │     no change │
│ QQuery 20    │    24.10 ms │            23.64 ms │     no change │
│ QQuery 21    │    34.13 ms │            36.03 ms │  1.06x slower │
│ QQuery 22    │  1049.93 ms │          1040.99 ms │     no change │
│ QQuery 23    │  1859.36 ms │          1882.59 ms │     no change │
│ QQuery 24    │   646.96 ms │           661.66 ms │     no change │
│ QQuery 25    │   525.98 ms │           526.04 ms │     no change │
│ QQuery 26    │   125.28 ms │           125.04 ms │     no change │
│ QQuery 27    │   501.63 ms │           520.79 ms │     no change │
│ QQuery 28    │   304.67 ms │           306.38 ms │     no change │
│ QQuery 29    │   437.65 ms │           452.99 ms │     no change │
│ QQuery 30    │    63.66 ms │            64.67 ms │     no change │
│ QQuery 31    │   299.10 ms │           319.80 ms │  1.07x slower │
│ QQuery 32    │    83.63 ms │            79.01 ms │ +1.06x faster │
│ QQuery 33    │   198.78 ms │           197.59 ms │     no change │
│ QQuery 34    │   165.32 ms │           162.00 ms │     no change │
│ QQuery 35    │   185.05 ms │           176.72 ms │     no change │
│ QQuery 36    │   296.82 ms │           312.84 ms │  1.05x slower │
│ QQuery 37    │   258.15 ms │           271.79 ms │  1.05x slower │
│ QQuery 38    │   151.03 ms │           156.34 ms │     no change │
│ QQuery 39    │   230.46 ms │           224.41 ms │     no change │
│ QQuery 40    │   192.88 ms │           196.48 ms │     no change │
│ QQuery 41    │    17.27 ms │            16.81 ms │     no change │
│ QQuery 42    │   144.01 ms │           147.78 ms │     no change │
│ QQuery 43    │   125.45 ms │           129.17 ms │     no change │
│ QQuery 44    │    16.41 ms │            15.86 ms │     no change │
│ QQuery 45    │    82.39 ms │            85.78 ms │     no change │
│ QQuery 46    │   335.51 ms │           347.39 ms │     no change │
│ QQuery 47    │  1393.13 ms │          1412.63 ms │     no change │
│ QQuery 48    │   425.26 ms │           424.93 ms │     no change │
│ QQuery 49    │   359.69 ms │           356.73 ms │     no change │
│ QQuery 50    │   342.99 ms │           358.46 ms │     no change │
│ QQuery 51    │   297.73 ms │           305.62 ms │     no change │
│ QQuery 52    │   142.42 ms │           148.88 ms │     no change │
│ QQuery 53    │   149.92 ms │           150.29 ms │     no change │
│ QQuery 54    │   218.63 ms │           218.03 ms │     no change │
│ QQuery 55    │   142.31 ms │           146.87 ms │     no change │
│ QQuery 56    │   193.07 ms │           196.69 ms │     no change │
│ QQuery 57    │   323.23 ms │           336.89 ms │     no change │
│ QQuery 58    │   533.04 ms │           537.14 ms │     no change │
│ QQuery 59    │   289.92 ms │           297.91 ms │     no change │
│ QQuery 60    │   202.35 ms │           204.30 ms │     no change │
│ QQuery 61    │   242.74 ms │           246.65 ms │     no change │
│ QQuery 62    │  1398.37 ms │          1350.48 ms │     no change │
│ QQuery 63    │   149.80 ms │           151.68 ms │     no change │
│ QQuery 64    │  1181.74 ms │          1196.44 ms │     no change │
│ QQuery 65    │   369.30 ms │           377.05 ms │     no change │
│ QQuery 66    │   395.77 ms │           396.50 ms │     no change │
│ QQuery 67    │   643.44 ms │           642.65 ms │     no change │
│ QQuery 68    │   393.11 ms │           392.83 ms │     no change │
│ QQuery 69    │   164.68 ms │           168.85 ms │     no change │
│ QQuery 70    │   514.64 ms │           536.96 ms │     no change │
│ QQuery 71    │   184.83 ms │           189.37 ms │     no change │
│ QQuery 72    │  2628.42 ms │          2605.00 ms │     no change │
│ QQuery 73    │   159.35 ms │           159.55 ms │     no change │
│ QQuery 74    │   894.53 ms │           915.98 ms │     no change │
│ QQuery 75    │   390.80 ms │           392.61 ms │     no change │
│ QQuery 76    │   192.34 ms │           190.95 ms │     no change │
│ QQuery 77    │   266.33 ms │           272.79 ms │     no change │
│ QQuery 78    │   963.48 ms │           968.34 ms │     no change │
│ QQuery 79    │   346.81 ms │           354.21 ms │     no change │
│ QQuery 80    │   505.89 ms │           501.59 ms │     no change │
│ QQuery 81    │    42.66 ms │            43.01 ms │     no change │
│ QQuery 82    │   293.69 ms │           303.02 ms │     no change │
│ QQuery 83    │    70.96 ms │            69.83 ms │     no change │
│ QQuery 84    │    64.83 ms │            64.59 ms │     no change │
│ QQuery 85    │   229.07 ms │           227.32 ms │     no change │
│ QQuery 86    │    62.15 ms │            59.60 ms │     no change │
│ QQuery 87    │   148.29 ms │           153.10 ms │     no change │
│ QQuery 88    │   241.41 ms │           253.95 ms │  1.05x slower │
│ QQuery 89    │   170.57 ms │           175.35 ms │     no change │
│ QQuery 90    │    36.47 ms │            38.72 ms │  1.06x slower │
│ QQuery 91    │   103.81 ms │            94.73 ms │ +1.10x faster │
│ QQuery 92    │    76.56 ms │            79.05 ms │     no change │
│ QQuery 93    │   272.15 ms │           268.56 ms │     no change │
│ QQuery 94    │    85.84 ms │            86.91 ms │     no change │
│ QQuery 95    │   262.50 ms │           267.70 ms │     no change │
│ QQuery 96    │   109.24 ms │           111.28 ms │     no change │
│ QQuery 97    │   188.91 ms │           195.71 ms │     no change │
│ QQuery 98    │   248.91 ms │           242.24 ms │     no change │
│ QQuery 99    │ 14932.12 ms │         15007.97 ms │     no change │
└──────────────┴─────────────┴─────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                  ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                  │ 53579.35ms │
│ Total Time (perf_in_list_optims)   │ 53997.54ms │
│ Average Time (HEAD)                │   541.21ms │
│ Average Time (perf_in_list_optims) │   545.43ms │
│ Queries Faster                     │          2 │
│ Queries Slower                     │          8 │
│ Queries with No Change             │         89 │
│ Queries with Failure               │          0 │
└────────────────────────────────────┴────────────┘

@geoffreyclaude

Copy link
Copy Markdown
Contributor Author

run benchmark tpch tpcds

@Dandandan how do IN LIST in the tpch queries get planned?

I think once this optim is done, there could be a lot to reuse for broadcast joins...

@Dandandan

Copy link
Copy Markdown
Contributor

run benchmark tpch tpcds

@Dandandan how do IN LIST in the tpch queries get planned?

I think once this optim is done, there could be a lot to reuse for broadcast joins...

For plain (non dynamic) filters, I think based on a treshold (<= 3) it either gets planned as a chain of or expressions or using InListExpr.
Probably we can change the treshold if it's better for fewer elems as well for primitive types.

@geoffreyclaude geoffreyclaude force-pushed the perf/in_list_optims branch 2 times, most recently from 7ba1c85 to 276a37f Compare December 19, 2025 16:25
@geoffreyclaude

Copy link
Copy Markdown
Contributor Author

run benchmark in_list

@alamb-ghbot

Copy link
Copy Markdown

🤖 ./gh_compare_branch_bench.sh compare_branch_bench.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing perf/in_list_optims (d18b346) to d68b629 diff
BENCH_NAME=in_list
BENCH_COMMAND=cargo bench --features=parquet --bench in_list
BENCH_FILTER=
BENCH_BRANCH_NAME=perf_in_list_optims
Results will be posted here when complete

@alamb-ghbot

Copy link
Copy Markdown

🤖: Benchmark completed

Details

group                                                  main                                   perf_in_list_optims
-----                                                  ----                                   -------------------
in_list/Float32/list=100/nulls=0%                      1.30     60.4±1.06µs        ? ?/sec    1.00     46.6±0.25µs        ? ?/sec
in_list/Float32/list=100/nulls=20%                     1.19     74.8±0.74µs        ? ?/sec    1.00     63.0±0.39µs        ? ?/sec
in_list/Float32/list=28/nulls=0%                       2.28     72.2±0.53µs        ? ?/sec    1.00     31.7±0.16µs        ? ?/sec
in_list/Float32/list=28/nulls=20%                      2.10     67.6±0.36µs        ? ?/sec    1.00     32.2±2.11µs        ? ?/sec
in_list/Float32/list=3/nulls=0%                        7.15     45.3±0.73µs        ? ?/sec    1.00      6.3±0.02µs        ? ?/sec
in_list/Float32/list=3/nulls=20%                       6.33     41.2±0.13µs        ? ?/sec    1.00      6.5±0.10µs        ? ?/sec
in_list/Float32/list=8/nulls=0%                        4.27     49.4±0.67µs        ? ?/sec    1.00     11.6±0.07µs        ? ?/sec
in_list/Float32/list=8/nulls=20%                       3.74     44.2±0.21µs        ? ?/sec    1.00     11.8±0.28µs        ? ?/sec
in_list/Int16/list=100/nulls=0%                        7.19     57.5±0.49µs        ? ?/sec    1.00      8.0±0.04µs        ? ?/sec
in_list/Int16/list=100/nulls=20%                       8.78     72.3±7.56µs        ? ?/sec    1.00      8.2±0.06µs        ? ?/sec
in_list/Int16/list=28/nulls=0%                         7.06     56.4±0.39µs        ? ?/sec    1.00      8.0±0.05µs        ? ?/sec
in_list/Int16/list=28/nulls=20%                        7.27     59.8±0.48µs        ? ?/sec    1.00      8.2±0.05µs        ? ?/sec
in_list/Int16/list=3/nulls=0%                          5.02     40.1±6.48µs        ? ?/sec    1.00      8.0±0.04µs        ? ?/sec
in_list/Int16/list=3/nulls=20%                         4.65     38.4±0.47µs        ? ?/sec    1.00      8.2±0.11µs        ? ?/sec
in_list/Int16/list=8/nulls=0%                          4.62     42.3±0.26µs        ? ?/sec    1.00      9.1±2.43µs        ? ?/sec
in_list/Int16/list=8/nulls=20%                         5.02     41.5±0.44µs        ? ?/sec    1.00      8.3±0.22µs        ? ?/sec
in_list/Int32/list=100/nulls=0%                        1.51     91.3±0.48µs        ? ?/sec    1.00     60.4±0.20µs        ? ?/sec
in_list/Int32/list=100/nulls=20%                       1.60     79.8±0.66µs        ? ?/sec    1.00     49.9±0.49µs        ? ?/sec
in_list/Int32/list=28/nulls=0%                         2.49     79.5±1.94µs        ? ?/sec    1.00     31.9±0.58µs        ? ?/sec
in_list/Int32/list=28/nulls=20%                        1.77     56.7±0.18µs        ? ?/sec    1.00     32.0±0.23µs        ? ?/sec
in_list/Int32/list=3/nulls=0%                          6.11     38.7±0.40µs        ? ?/sec    1.00      6.3±0.07µs        ? ?/sec
in_list/Int32/list=3/nulls=20%                         5.88     38.5±0.94µs        ? ?/sec    1.00      6.5±0.14µs        ? ?/sec
in_list/Int32/list=8/nulls=0%                          3.62     42.1±0.17µs        ? ?/sec    1.00     11.6±0.39µs        ? ?/sec
in_list/Int32/list=8/nulls=20%                         3.50     41.3±0.15µs        ? ?/sec    1.00     11.8±0.06µs        ? ?/sec
in_list/TimestampNs/list=100/nulls=0%                  1.05     67.1±1.11µs        ? ?/sec    1.00     63.9±0.37µs        ? ?/sec
in_list/TimestampNs/list=100/nulls=20%                 3.29    124.4±0.56µs        ? ?/sec    1.00     37.8±0.22µs        ? ?/sec
in_list/TimestampNs/list=28/nulls=0%                   1.61     75.2±0.69µs        ? ?/sec    1.00     46.6±0.14µs        ? ?/sec
in_list/TimestampNs/list=28/nulls=20%                  2.14    101.9±1.05µs        ? ?/sec    1.00     47.7±0.17µs        ? ?/sec
in_list/TimestampNs/list=3/nulls=0%                    4.37     53.8±0.27µs        ? ?/sec    1.00     12.3±0.06µs        ? ?/sec
in_list/TimestampNs/list=3/nulls=20%                   7.35     92.1±0.44µs        ? ?/sec    1.00     12.5±0.04µs        ? ?/sec
in_list/TimestampNs/list=8/nulls=0%                    2.21     57.3±0.33µs        ? ?/sec    1.00     25.9±0.22µs        ? ?/sec
in_list/TimestampNs/list=8/nulls=20%                   3.61     96.8±9.21µs        ? ?/sec    1.00     26.8±2.58µs        ? ?/sec
in_list/UInt8/list=100/nulls=0%                        8.34     66.6±0.35µs        ? ?/sec    1.00      8.0±0.36µs        ? ?/sec
in_list/UInt8/list=100/nulls=20%                       9.44     76.5±0.58µs        ? ?/sec    1.00      8.1±0.11µs        ? ?/sec
in_list/UInt8/list=28/nulls=0%                         7.42     58.7±2.02µs        ? ?/sec    1.00      7.9±0.17µs        ? ?/sec
in_list/UInt8/list=28/nulls=20%                        6.45     52.7±0.56µs        ? ?/sec    1.00      8.2±0.04µs        ? ?/sec
in_list/UInt8/list=3/nulls=0%                          4.74     37.5±0.12µs        ? ?/sec    1.00      7.9±0.23µs        ? ?/sec
in_list/UInt8/list=3/nulls=20%                         4.65     37.6±3.90µs        ? ?/sec    1.00      8.1±0.05µs        ? ?/sec
in_list/UInt8/list=8/nulls=0%                          5.27     41.7±0.26µs        ? ?/sec    1.00      7.9±0.22µs        ? ?/sec
in_list/UInt8/list=8/nulls=20%                         5.25     42.5±0.52µs        ? ?/sec    1.00      8.1±0.07µs        ? ?/sec
in_list/Utf8/list=100/nulls=0%/str=100                 1.00    146.0±0.80µs        ? ?/sec    1.27    185.5±1.86µs        ? ?/sec
in_list/Utf8/list=100/nulls=0%/str=12                  1.00     93.1±4.16µs        ? ?/sec    1.32    123.2±1.00µs        ? ?/sec
in_list/Utf8/list=100/nulls=0%/str=3                   1.00     98.1±0.30µs        ? ?/sec    1.17   114.9±16.18µs        ? ?/sec
in_list/Utf8/list=100/nulls=20%/str=100                1.00    172.9±1.42µs        ? ?/sec    1.14    196.7±2.51µs        ? ?/sec
in_list/Utf8/list=100/nulls=20%/str=12                 1.00    140.5±1.15µs        ? ?/sec    1.02    143.0±1.08µs        ? ?/sec
in_list/Utf8/list=100/nulls=20%/str=3                  1.00    119.1±0.85µs        ? ?/sec    1.00    118.6±1.40µs        ? ?/sec
in_list/Utf8/list=28/nulls=0%/str=100                  1.00    142.3±3.80µs        ? ?/sec    1.25    177.7±0.88µs        ? ?/sec
in_list/Utf8/list=28/nulls=0%/str=12                   1.00     92.9±4.71µs        ? ?/sec    1.72    159.7±2.60µs        ? ?/sec
in_list/Utf8/list=28/nulls=0%/str=3                    1.00     82.8±2.12µs        ? ?/sec    1.87    155.2±4.21µs        ? ?/sec
in_list/Utf8/list=28/nulls=20%/str=100                 1.00    178.5±2.07µs        ? ?/sec    1.06    189.7±1.07µs        ? ?/sec
in_list/Utf8/list=28/nulls=20%/str=12                  1.15    150.1±3.06µs        ? ?/sec    1.00    130.4±0.73µs        ? ?/sec
in_list/Utf8/list=28/nulls=20%/str=3                   1.25    144.3±0.96µs        ? ?/sec    1.00    115.8±3.96µs        ? ?/sec
in_list/Utf8/list=3/nulls=0%/str=100                   1.00    129.1±4.24µs        ? ?/sec    1.17   150.5±19.48µs        ? ?/sec
in_list/Utf8/list=3/nulls=0%/str=12                    1.00     70.7±0.51µs        ? ?/sec    1.26     89.2±0.60µs        ? ?/sec
in_list/Utf8/list=3/nulls=0%/str=3                     1.00     72.1±1.30µs        ? ?/sec    1.30     93.7±0.73µs        ? ?/sec
in_list/Utf8/list=3/nulls=20%/str=100                  1.06    154.2±0.99µs        ? ?/sec    1.00    145.8±1.44µs        ? ?/sec
in_list/Utf8/list=3/nulls=20%/str=12                   1.07    108.6±0.46µs        ? ?/sec    1.00    101.9±0.82µs        ? ?/sec
in_list/Utf8/list=3/nulls=20%/str=3                    1.06    111.0±2.15µs        ? ?/sec    1.00    104.9±1.39µs        ? ?/sec
in_list/Utf8/list=8/nulls=0%/str=100                   1.00    134.0±4.84µs        ? ?/sec    1.14    152.6±1.79µs        ? ?/sec
in_list/Utf8/list=8/nulls=0%/str=12                    1.00     75.2±0.35µs        ? ?/sec    1.27     95.4±0.40µs        ? ?/sec
in_list/Utf8/list=8/nulls=0%/str=3                     1.00     76.2±2.09µs        ? ?/sec    1.30     98.9±2.35µs        ? ?/sec
in_list/Utf8/list=8/nulls=20%/str=100                  1.05    157.8±4.39µs        ? ?/sec    1.00    150.3±0.47µs        ? ?/sec
in_list/Utf8/list=8/nulls=20%/str=12                   1.11   117.5±14.54µs        ? ?/sec    1.00    106.2±0.65µs        ? ?/sec
in_list/Utf8/list=8/nulls=20%/str=3                    1.05    115.2±0.82µs        ? ?/sec    1.00    109.5±0.78µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=0%/nulls=0%                                                 1.00    155.7±0.84µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=0%/nulls=20%                                                1.00    157.8±1.16µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=25%/nulls=0%                                                1.00   218.9±13.44µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=25%/nulls=20%                                               1.00    178.4±1.09µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=75%/nulls=0%                                                1.00    195.4±3.97µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=75%/nulls=20%                                               1.00   216.0±11.18µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=0%/nulls=0%                                                  1.00    199.2±0.77µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=0%/nulls=20%                                                 1.00    150.5±1.96µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=25%/nulls=0%                                                 1.00    222.5±0.94µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=25%/nulls=20%                                                1.00    178.8±1.14µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=75%/nulls=0%                                                 1.00    197.7±4.35µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=75%/nulls=20%                                                1.00    225.4±4.27µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=0%/nulls=0%                                                   1.00    123.9±2.71µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=0%/nulls=20%                                                  1.00    133.0±0.91µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=25%/nulls=0%                                                  1.00    158.3±1.39µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=25%/nulls=20%                                                 1.00    163.9±5.62µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=75%/nulls=0%                                                  1.00    177.6±6.66µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=75%/nulls=20%                                                 1.00    212.9±5.21µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=0%/nulls=0%                                                   1.00    129.9±1.70µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=0%/nulls=20%                                                  1.00    137.6±1.55µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=25%/nulls=0%                                                  1.00    176.4±1.30µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=25%/nulls=20%                                                 1.00    170.3±1.39µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=75%/nulls=0%                                                  1.00    186.5±5.64µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=75%/nulls=20%                                                 1.00    212.1±7.79µs        ? ?/sec
in_list/Utf8View/list=100/nulls=0%/str=100             2.48    164.3±5.30µs        ? ?/sec    1.00     66.2±0.44µs        ? ?/sec
in_list/Utf8View/list=100/nulls=0%/str=12              1.26     89.6±0.84µs        ? ?/sec    1.00     71.4±0.31µs        ? ?/sec
in_list/Utf8View/list=100/nulls=0%/str=3               2.26    130.3±0.58µs        ? ?/sec    1.00     57.6±1.08µs        ? ?/sec
in_list/Utf8View/list=100/nulls=20%/str=100            1.99    181.1±4.23µs        ? ?/sec    1.00     91.2±0.49µs        ? ?/sec
in_list/Utf8View/list=100/nulls=20%/str=12             2.16    145.1±7.32µs        ? ?/sec    1.00     67.3±0.16µs        ? ?/sec
in_list/Utf8View/list=100/nulls=20%/str=3              1.95    121.3±0.60µs        ? ?/sec    1.00     62.1±0.90µs        ? ?/sec
in_list/Utf8View/list=28/nulls=0%/str=100              2.66    164.8±0.59µs        ? ?/sec    1.00     62.0±2.47µs        ? ?/sec
in_list/Utf8View/list=28/nulls=0%/str=12               1.72     90.2±0.35µs        ? ?/sec    1.00     52.5±0.22µs        ? ?/sec
in_list/Utf8View/list=28/nulls=0%/str=3                2.31    125.3±1.87µs        ? ?/sec    1.00     54.1±0.30µs        ? ?/sec
in_list/Utf8View/list=28/nulls=20%/str=100             3.30    211.5±1.23µs        ? ?/sec    1.00     64.0±0.50µs        ? ?/sec
in_list/Utf8View/list=28/nulls=20%/str=12              1.49    158.6±1.39µs        ? ?/sec    1.00    106.4±1.02µs        ? ?/sec
in_list/Utf8View/list=28/nulls=20%/str=3               1.66    149.8±8.63µs        ? ?/sec    1.00     90.4±1.24µs        ? ?/sec
in_list/Utf8View/list=3/nulls=0%/str=100               3.03    136.5±2.50µs        ? ?/sec    1.00     45.0±0.26µs        ? ?/sec
in_list/Utf8View/list=3/nulls=0%/str=12                4.26     69.2±0.25µs        ? ?/sec    1.00     16.3±0.52µs        ? ?/sec
in_list/Utf8View/list=3/nulls=0%/str=3                 4.39     71.0±0.36µs        ? ?/sec    1.00     16.2±0.09µs        ? ?/sec
in_list/Utf8View/list=3/nulls=20%/str=100              3.19    165.7±1.40µs        ? ?/sec    1.00     51.9±0.13µs        ? ?/sec
in_list/Utf8View/list=3/nulls=20%/str=12               6.81    112.5±0.49µs        ? ?/sec    1.00     16.5±0.31µs        ? ?/sec
in_list/Utf8View/list=3/nulls=20%/str=3                7.07    115.9±0.59µs        ? ?/sec    1.00     16.4±0.06µs        ? ?/sec
in_list/Utf8View/list=8/nulls=0%/str=100               3.05    140.7±2.44µs        ? ?/sec    1.00     46.1±1.42µs        ? ?/sec
in_list/Utf8View/list=8/nulls=0%/str=12                1.54     74.4±0.47µs        ? ?/sec    1.00     48.2±0.47µs        ? ?/sec
in_list/Utf8View/list=8/nulls=0%/str=3                 1.58     76.3±1.46µs        ? ?/sec    1.00     48.3±0.26µs        ? ?/sec
in_list/Utf8View/list=8/nulls=20%/str=100              3.07    168.3±0.89µs        ? ?/sec    1.00     54.7±0.46µs        ? ?/sec
in_list/Utf8View/list=8/nulls=20%/str=12               2.42    114.8±1.27µs        ? ?/sec    1.00     47.5±0.41µs        ? ?/sec
in_list/Utf8View/list=8/nulls=20%/str=3                2.60   123.4±16.45µs        ? ?/sec    1.00     47.5±0.58µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=0%/nulls=0%                                             1.00    101.5±2.22µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=0%/nulls=20%                                            1.00     82.2±0.40µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=25%/nulls=0%                                            1.00    123.6±1.43µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=25%/nulls=20%                                           1.00    128.4±1.88µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=75%/nulls=0%                                            1.00    149.1±0.82µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=75%/nulls=20%                                           1.00    136.4±3.67µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=0%/nulls=0%                                              1.00     91.2±0.49µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=0%/nulls=20%                                             1.00     75.5±9.20µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=25%/nulls=0%                                             1.00    131.5±0.47µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=25%/nulls=20%                                            1.00    139.1±0.50µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=75%/nulls=0%                                             1.00    140.8±1.85µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=75%/nulls=20%                                            1.00    144.9±0.66µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=0%/nulls=0%                                               1.00     67.6±0.37µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=0%/nulls=20%                                              1.00     64.0±0.50µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=25%/nulls=0%                                              1.00    109.0±0.88µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=25%/nulls=20%                                             1.00   106.2±15.70µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=75%/nulls=0%                                              1.00    110.7±0.74µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=75%/nulls=20%                                             1.00    140.8±0.65µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=0%/nulls=0%                                               1.00     72.1±1.30µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=0%/nulls=20%                                              1.00     66.3±0.23µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=25%/nulls=0%                                              1.00    105.6±2.88µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=25%/nulls=20%                                             1.00    110.8±1.19µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=75%/nulls=0%                                              1.00    125.0±5.84µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=75%/nulls=20%                                             1.00    131.0±1.08µs        ? ?/sec

@geoffreyclaude geoffreyclaude force-pushed the perf/in_list_optims branch 3 times, most recently from 2fc00e5 to 3db393a Compare December 19, 2025 17:13
@geoffreyclaude

Copy link
Copy Markdown
Contributor Author

run benchmark in_list

@alamb-ghbot

Copy link
Copy Markdown

🤖 ./gh_compare_branch_bench.sh compare_branch_bench.sh Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing perf/in_list_optims (3db393a) to d68b629 diff
BENCH_NAME=in_list
BENCH_COMMAND=cargo bench --features=parquet --bench in_list
BENCH_FILTER=
BENCH_BRANCH_NAME=perf_in_list_optims
Results will be posted here when complete

@alamb-ghbot

Copy link
Copy Markdown

🤖: Benchmark completed

Details

group                                                  main                                   perf_in_list_optims
-----                                                  ----                                   -------------------
in_list/Float32/list=100/nulls=0%                      1.00     61.4±0.27µs        ? ?/sec    1.04     63.6±0.24µs        ? ?/sec
in_list/Float32/list=100/nulls=20%                     1.41    122.7±3.25µs        ? ?/sec    1.00     87.2±0.51µs        ? ?/sec
in_list/Float32/list=28/nulls=0%                       1.56     49.6±0.14µs        ? ?/sec    1.00     31.8±0.66µs        ? ?/sec
in_list/Float32/list=28/nulls=20%                      2.71     76.6±0.31µs        ? ?/sec    1.00     28.3±0.23µs        ? ?/sec
in_list/Float32/list=3/nulls=0%                        6.79     43.0±3.82µs        ? ?/sec    1.00      6.3±0.05µs        ? ?/sec
in_list/Float32/list=3/nulls=20%                       1.60     41.5±0.84µs        ? ?/sec    1.00     26.0±0.15µs        ? ?/sec
in_list/Float32/list=8/nulls=0%                        3.77     45.0±0.16µs        ? ?/sec    1.00     11.9±1.99µs        ? ?/sec
in_list/Float32/list=8/nulls=20%                       1.90     48.7±0.47µs        ? ?/sec    1.00     25.6±0.20µs        ? ?/sec
in_list/Int16/list=100/nulls=0%                        10.27    82.1±0.34µs        ? ?/sec    1.00      8.0±0.07µs        ? ?/sec
in_list/Int16/list=100/nulls=20%                       2.85     49.6±0.27µs        ? ?/sec    1.00     17.4±0.10µs        ? ?/sec
in_list/Int16/list=28/nulls=0%                         10.12    81.0±0.50µs        ? ?/sec    1.00      8.0±0.05µs        ? ?/sec
in_list/Int16/list=28/nulls=20%                        4.87     85.6±9.18µs        ? ?/sec    1.00     17.6±0.17µs        ? ?/sec
in_list/Int16/list=3/nulls=0%                          4.81     38.5±0.13µs        ? ?/sec    1.00      8.0±0.03µs        ? ?/sec
in_list/Int16/list=3/nulls=20%                         2.12     38.0±0.12µs        ? ?/sec    1.00     18.0±0.40µs        ? ?/sec
in_list/Int16/list=8/nulls=0%                          5.43     43.5±0.25µs        ? ?/sec    1.00      8.0±0.25µs        ? ?/sec
in_list/Int16/list=8/nulls=20%                         2.35     41.2±0.26µs        ? ?/sec    1.00     17.5±0.15µs        ? ?/sec
in_list/Int32/list=100/nulls=0%                        1.00     47.0±0.38µs        ? ?/sec    1.02     48.0±0.22µs        ? ?/sec
in_list/Int32/list=100/nulls=20%                       1.54     91.2±0.45µs        ? ?/sec    1.00     59.2±0.29µs        ? ?/sec
in_list/Int32/list=28/nulls=0%                         1.44     45.8±0.21µs        ? ?/sec    1.00     31.8±0.11µs        ? ?/sec
in_list/Int32/list=28/nulls=20%                        2.44     69.2±0.50µs        ? ?/sec    1.00     28.3±0.14µs        ? ?/sec
in_list/Int32/list=3/nulls=0%                          6.03     38.2±0.21µs        ? ?/sec    1.00      6.3±0.04µs        ? ?/sec
in_list/Int32/list=3/nulls=20%                         1.46     38.1±0.25µs        ? ?/sec    1.00     26.2±1.96µs        ? ?/sec
in_list/Int32/list=8/nulls=0%                          3.68     42.4±0.47µs        ? ?/sec    1.00     11.5±0.09µs        ? ?/sec
in_list/Int32/list=8/nulls=20%                         1.63     41.2±0.46µs        ? ?/sec    1.00     25.4±0.22µs        ? ?/sec
in_list/TimestampNs/list=100/nulls=0%                  1.47     77.5±0.79µs        ? ?/sec    1.00     52.6±0.72µs        ? ?/sec
in_list/TimestampNs/list=100/nulls=20%                 1.92    127.3±1.09µs        ? ?/sec    1.00     66.5±1.93µs        ? ?/sec
in_list/TimestampNs/list=28/nulls=0%                   1.21     62.6±4.44µs        ? ?/sec    1.00     52.0±0.80µs        ? ?/sec
in_list/TimestampNs/list=28/nulls=20%                  1.55    116.1±0.26µs        ? ?/sec    1.00     75.0±0.81µs        ? ?/sec
in_list/TimestampNs/list=3/nulls=0%                    5.36     53.8±0.67µs        ? ?/sec    1.00     10.0±0.48µs        ? ?/sec
in_list/TimestampNs/list=3/nulls=20%                   3.56     92.9±3.25µs        ? ?/sec    1.00     26.1±0.17µs        ? ?/sec
in_list/TimestampNs/list=8/nulls=0%                    2.55     58.1±0.36µs        ? ?/sec    1.00     22.8±0.24µs        ? ?/sec
in_list/TimestampNs/list=8/nulls=20%                   3.42     94.4±0.34µs        ? ?/sec    1.00     27.6±0.40µs        ? ?/sec
in_list/UInt8/list=100/nulls=0%                        8.26     71.4±1.78µs        ? ?/sec    1.00      8.6±0.28µs        ? ?/sec
in_list/UInt8/list=100/nulls=20%                       4.33     79.3±0.58µs        ? ?/sec    1.00     18.3±0.86µs        ? ?/sec
in_list/UInt8/list=28/nulls=0%                         6.37     54.7±0.30µs        ? ?/sec    1.00      8.6±0.04µs        ? ?/sec
in_list/UInt8/list=28/nulls=20%                        2.90     51.7±0.50µs        ? ?/sec    1.00     17.9±0.20µs        ? ?/sec
in_list/UInt8/list=3/nulls=0%                          4.27     36.5±0.37µs        ? ?/sec    1.00      8.5±0.37µs        ? ?/sec
in_list/UInt8/list=3/nulls=20%                         2.00     35.6±0.44µs        ? ?/sec    1.00     17.8±0.09µs        ? ?/sec
in_list/UInt8/list=8/nulls=0%                          5.00     43.1±0.35µs        ? ?/sec    1.00      8.6±0.12µs        ? ?/sec
in_list/UInt8/list=8/nulls=20%                         2.42     42.7±1.70µs        ? ?/sec    1.00     17.7±0.15µs        ? ?/sec
in_list/Utf8/list=100/nulls=0%/str=100                 1.00    160.3±0.54µs        ? ?/sec    1.09    174.4±1.20µs        ? ?/sec
in_list/Utf8/list=100/nulls=0%/str=12                  1.00     91.3±2.54µs        ? ?/sec    1.99    181.4±6.08µs        ? ?/sec
in_list/Utf8/list=100/nulls=0%/str=3                   1.00    107.7±3.18µs        ? ?/sec    1.38    148.9±1.70µs        ? ?/sec
in_list/Utf8/list=100/nulls=20%/str=100                1.00    178.7±1.33µs        ? ?/sec    1.05    188.2±1.78µs        ? ?/sec
in_list/Utf8/list=100/nulls=20%/str=12                 1.00    132.3±2.72µs        ? ?/sec    1.16    153.9±6.27µs        ? ?/sec
in_list/Utf8/list=100/nulls=20%/str=3                  1.00    168.4±4.06µs        ? ?/sec    1.01    169.6±1.76µs        ? ?/sec
in_list/Utf8/list=28/nulls=0%/str=100                  1.00    139.3±0.94µs        ? ?/sec    1.50    208.4±1.87µs        ? ?/sec
in_list/Utf8/list=28/nulls=0%/str=12                   1.14    122.4±2.14µs        ? ?/sec    1.00    107.8±0.69µs        ? ?/sec
in_list/Utf8/list=28/nulls=0%/str=3                    1.00     97.7±3.24µs        ? ?/sec    1.22    119.6±3.02µs        ? ?/sec
in_list/Utf8/list=28/nulls=20%/str=100                 1.00    182.4±2.03µs        ? ?/sec    1.11    203.0±0.87µs        ? ?/sec
in_list/Utf8/list=28/nulls=20%/str=12                  1.00    138.8±0.60µs        ? ?/sec    1.25    173.8±1.60µs        ? ?/sec
in_list/Utf8/list=28/nulls=20%/str=3                   1.00   123.4±10.84µs        ? ?/sec    1.18    146.0±0.37µs        ? ?/sec
in_list/Utf8/list=3/nulls=0%/str=100                   1.00    131.8±9.42µs        ? ?/sec    1.14   150.7±14.87µs        ? ?/sec
in_list/Utf8/list=3/nulls=0%/str=12                    1.00     70.8±0.37µs        ? ?/sec    1.29     91.2±1.16µs        ? ?/sec
in_list/Utf8/list=3/nulls=0%/str=3                     1.00     71.9±0.35µs        ? ?/sec    1.31     94.5±0.53µs        ? ?/sec
in_list/Utf8/list=3/nulls=20%/str=100                  1.00    154.2±2.13µs        ? ?/sec    1.10    169.0±5.03µs        ? ?/sec
in_list/Utf8/list=3/nulls=20%/str=12                   1.00    109.8±0.45µs        ? ?/sec    1.15    126.3±0.38µs        ? ?/sec
in_list/Utf8/list=3/nulls=20%/str=3                    1.00    111.6±1.74µs        ? ?/sec    1.16    129.0±0.76µs        ? ?/sec
in_list/Utf8/list=8/nulls=0%/str=100                   1.00    134.7±2.87µs        ? ?/sec    1.15    154.6±1.92µs        ? ?/sec
in_list/Utf8/list=8/nulls=0%/str=12                    1.00     75.8±1.52µs        ? ?/sec    1.30     98.4±3.00µs        ? ?/sec
in_list/Utf8/list=8/nulls=0%/str=3                     1.00    80.3±10.28µs        ? ?/sec    1.28    102.5±1.33µs        ? ?/sec
in_list/Utf8/list=8/nulls=20%/str=100                  1.00    157.5±1.11µs        ? ?/sec    1.11    174.1±8.37µs        ? ?/sec
in_list/Utf8/list=8/nulls=20%/str=12                   1.00    115.2±0.72µs        ? ?/sec    1.13    130.5±1.14µs        ? ?/sec
in_list/Utf8/list=8/nulls=20%/str=3                    1.00    115.2±1.21µs        ? ?/sec    1.20    138.2±1.54µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=0%/nulls=0%                                                 1.00    145.0±0.93µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=0%/nulls=20%                                                1.00    185.9±0.88µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=25%/nulls=0%                                                1.00    222.8±5.76µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=25%/nulls=20%                                               1.00    200.0±0.51µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=75%/nulls=0%                                                1.00    195.8±0.61µs        ? ?/sec
in_list/Utf8/mixed/list=100/match=75%/nulls=20%                                               1.00    212.3±0.86µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=0%/nulls=0%                                                  1.00    150.9±1.13µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=0%/nulls=20%                                                 1.00    201.1±3.40µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=25%/nulls=0%                                                 1.00    209.8±2.22µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=25%/nulls=20%                                                1.00    199.4±0.38µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=75%/nulls=0%                                                 1.00    179.2±0.40µs        ? ?/sec
in_list/Utf8/mixed/list=28/match=75%/nulls=20%                                                1.00   215.3±19.57µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=0%/nulls=0%                                                   1.00    125.7±2.17µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=0%/nulls=20%                                                  1.00    159.4±5.51µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=25%/nulls=0%                                                  1.00    156.7±1.19µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=25%/nulls=20%                                                 1.00    185.8±0.84µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=75%/nulls=0%                                                  1.00    176.1±5.67µs        ? ?/sec
in_list/Utf8/mixed/list=3/match=75%/nulls=20%                                                 1.00    207.7±0.77µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=0%/nulls=0%                                                   1.00    130.5±0.49µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=0%/nulls=20%                                                  1.00    167.1±2.49µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=25%/nulls=0%                                                  1.00    170.3±3.78µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=25%/nulls=20%                                                 1.00    201.0±4.91µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=75%/nulls=0%                                                  1.00    176.6±2.03µs        ? ?/sec
in_list/Utf8/mixed/list=8/match=75%/nulls=20%                                                 1.00    205.7±4.27µs        ? ?/sec
in_list/Utf8View/list=100/nulls=0%/str=100             1.84    159.0±5.20µs        ? ?/sec    1.00     86.3±0.43µs        ? ?/sec
in_list/Utf8View/list=100/nulls=0%/str=12              1.12     94.7±2.52µs        ? ?/sec    1.00     84.5±0.45µs        ? ?/sec
in_list/Utf8View/list=100/nulls=0%/str=3               2.31    151.9±3.47µs        ? ?/sec    1.00     65.8±0.91µs        ? ?/sec
in_list/Utf8View/list=100/nulls=20%/str=100            2.15    182.7±1.52µs        ? ?/sec    1.00     84.8±0.83µs        ? ?/sec
in_list/Utf8View/list=100/nulls=20%/str=12             1.94    131.2±0.56µs        ? ?/sec    1.00     67.5±1.36µs        ? ?/sec
in_list/Utf8View/list=100/nulls=20%/str=3              2.08    132.1±1.04µs        ? ?/sec    1.00     63.4±0.31µs        ? ?/sec
in_list/Utf8View/list=28/nulls=0%/str=100              2.71    194.9±1.70µs        ? ?/sec    1.00     72.1±1.09µs        ? ?/sec
in_list/Utf8View/list=28/nulls=0%/str=12               1.73     95.1±0.28µs        ? ?/sec    1.00     54.9±1.33µs        ? ?/sec
in_list/Utf8View/list=28/nulls=0%/str=3                1.57     82.4±0.63µs        ? ?/sec    1.00     52.3±1.28µs        ? ?/sec
in_list/Utf8View/list=28/nulls=20%/str=100             1.87   213.0±14.99µs        ? ?/sec    1.00    114.0±1.80µs        ? ?/sec
in_list/Utf8View/list=28/nulls=20%/str=12              1.32    120.1±0.53µs        ? ?/sec    1.00     91.1±0.76µs        ? ?/sec
in_list/Utf8View/list=28/nulls=20%/str=3               1.45    129.4±0.33µs        ? ?/sec    1.00     89.3±0.87µs        ? ?/sec
in_list/Utf8View/list=3/nulls=0%/str=100               3.14    136.7±5.53µs        ? ?/sec    1.00     43.6±0.32µs        ? ?/sec
in_list/Utf8View/list=3/nulls=0%/str=12                4.56     71.2±6.86µs        ? ?/sec    1.00     15.6±0.70µs        ? ?/sec
in_list/Utf8View/list=3/nulls=0%/str=3                 4.59     71.3±2.27µs        ? ?/sec    1.00     15.5±0.49µs        ? ?/sec
in_list/Utf8View/list=3/nulls=20%/str=100              2.13    165.5±1.43µs        ? ?/sec    1.00     77.8±1.29µs        ? ?/sec
in_list/Utf8View/list=3/nulls=20%/str=12               3.83    113.0±4.15µs        ? ?/sec    1.00     29.5±0.23µs        ? ?/sec
in_list/Utf8View/list=3/nulls=20%/str=3                3.92    116.0±0.60µs        ? ?/sec    1.00     29.6±0.31µs        ? ?/sec
in_list/Utf8View/list=8/nulls=0%/str=100               2.81    141.0±0.86µs        ? ?/sec    1.00     50.2±0.16µs        ? ?/sec
in_list/Utf8View/list=8/nulls=0%/str=12                1.53     74.9±0.55µs        ? ?/sec    1.00     48.8±0.26µs        ? ?/sec
in_list/Utf8View/list=8/nulls=0%/str=3                 1.58     76.9±0.33µs        ? ?/sec    1.00     48.7±0.20µs        ? ?/sec
in_list/Utf8View/list=8/nulls=20%/str=100              2.17    170.4±3.26µs        ? ?/sec    1.00     78.7±0.29µs        ? ?/sec
in_list/Utf8View/list=8/nulls=20%/str=12               2.04    115.6±0.53µs        ? ?/sec    1.00     56.8±0.99µs        ? ?/sec
in_list/Utf8View/list=8/nulls=20%/str=3                2.14    120.4±0.44µs        ? ?/sec    1.00     56.3±0.57µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=0%/nulls=0%                                             1.00     84.5±0.37µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=0%/nulls=20%                                            1.00    103.2±0.53µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=25%/nulls=0%                                            1.00    126.7±0.42µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=25%/nulls=20%                                           1.00    140.4±1.19µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=75%/nulls=0%                                            1.00    134.7±1.11µs        ? ?/sec
in_list/Utf8View/mixed/list=100/match=75%/nulls=20%                                           1.00    150.7±1.27µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=0%/nulls=0%                                              1.00     83.0±0.72µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=0%/nulls=20%                                             1.00    104.4±0.67µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=25%/nulls=0%                                             1.00    130.7±9.46µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=25%/nulls=20%                                            1.00    150.8±1.49µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=75%/nulls=0%                                             1.00    140.3±0.53µs        ? ?/sec
in_list/Utf8View/mixed/list=28/match=75%/nulls=20%                                            1.00    151.2±5.85µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=0%/nulls=0%                                               1.00     70.0±1.59µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=0%/nulls=20%                                              1.00     99.0±0.73µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=25%/nulls=0%                                              1.00    102.8±0.72µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=25%/nulls=20%                                             1.00    129.5±1.07µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=75%/nulls=0%                                              1.00    104.4±0.77µs        ? ?/sec
in_list/Utf8View/mixed/list=3/match=75%/nulls=20%                                             1.00    152.3±1.11µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=0%/nulls=0%                                               1.00     70.4±0.25µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=0%/nulls=20%                                              1.00    101.1±2.39µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=25%/nulls=0%                                              1.00    103.4±0.66µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=25%/nulls=20%                                             1.00    124.4±0.62µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=75%/nulls=0%                                              1.00     97.3±0.32µs        ? ?/sec
in_list/Utf8View/mixed/list=8/match=75%/nulls=20%                                             1.00    143.7±7.61µs        ? ?/sec

@alamb

alamb commented May 27, 2026

Copy link
Copy Markdown
Contributor

Thsoe are some pretty sweet performance results. I will try and find some time to review this more carefully

@alamb alamb changed the title IN LIST optims Optimize IN performance with specialized implementations May 27, 2026
Replaces HashSet<u8> with a 32-byte stack-allocated bitmap. Provides O(1) membership testing via bit-shifting, significantly reducing memory overhead and improving cache locality. Triggers for UInt8 arrays.
Implements an 8 KB heap-allocated bitmap for UInt16. Maintains O(1) performance while handling the larger value space. Triggers for UInt16 arrays.
Introduces zero-copy buffer reinterpretation to allow signed integers and other 1 or 2-byte primitive types (e.g. Float16) to use the high-performance bitmap filters. Triggers for all types with 1-byte or 2-byte width.
Adds a const-generic unrolled comparison chain that avoids CPU branching. Outperforms hash lookups for very small lists. Triggers for primitives when list size <= 32 (4-byte), 16 (8-byte), or 4 (16-byte).
Implements a fast hash table using open addressing with linear probing and a 25% load factor. Replaces the legacy HashSet for primitives, reducing indirection. Triggers for primitives when list size exceeds branchless thresholds.
Introduces a two-stage filter for ByteView types. Stage 1 uses a fast DirectProbeFilter on masked views (len + prefix) for quick rejection; Stage 2 performs full verification only for potential long-string matches. Triggers for Utf8View and BinaryView.
Port of the two-stage View optimization to standard Utf8 and LargeUtf8 types. Encodes strings as i128 (len + prefix) for fast O(1) pre-filtering before falling back to full string comparison. Triggers for Utf8 and LargeUtf8.
FixedSizeBinary(N) arrays share the same contiguous buffer layout as primitive arrays, so for power-of-2 widths (1, 2, 4, 8, 16) we can zero-copy reinterpret them and use the optimized primitive filters (bitmap, branchless, hash) instead of falling through to the NestedTypeFilter fallback.
@geoffreyclaude

Copy link
Copy Markdown
Contributor Author

@adriangb @alamb In case you missed it, I've closed this PR and rewritten it as a stack of multiple PRs (one per optim.) The root issue #19241 links them all in order. Due to github limitations, I can't do proper stacked PRs so each PR has all the previous commits in it. But I'll rebase over main as we merge them in order, which will clean them up.

saadtajwar pushed a commit to saadtajwar/datafusion that referenced this pull request Jun 22, 2026
## Which issue does this PR close?

- Part of apache#19241.
- This PR was originally proposed as the first commit in the broader `IN
LIST` optimization series in apache#19390.
- This PR builds on the refactor extracted in apache#21649.

## Rationale for this change

After apache#21649, non-primitive constant `IN LIST` evaluation still uses the
extracted `ArrayStaticFilter` fallback path. That path relies on
comparator checks for each input row. This PR replaces that fallback
lookup with a precomputed hash table and shared result construction so
generic constant-list evaluation is cheaper before the later specialized
primitive and string optimizations from apache#19390.

## What changes are included in this PR?

The PR is split so reviewers can separate mechanical cleanup from the
behavior/performance changes:

1. `Refactor generic InList static filter helpers`

Pure refactoring. This moves the existing generic static-filter
construction and probe loop into helper methods inside
`ArrayStaticFilter`, without changing the lookup data structure or
result semantics.

2. `Build InList results from bitmaps`

Changes how the generic path materializes `BooleanArray` results after
membership has been computed. Instead of mixing membership checks and
SQL three-valued null handling in the row loop, this builds a contains
bitmap first and applies the null/negation rules with bitmap operations.
This keeps the same `IN` / `NOT IN` semantics, including the `NULL`
cases.

3. `Optimize generic InList static filtering`

Replaces the fallback lookup storage from a unit-valued raw-entry
`HashMap` to `hashbrown::HashTable<usize>`. The table still stores
indices into the constant list and still uses Arrow hashing plus
`make_comparator` for equality, but avoids the extra map value
bookkeeping.

The existing specialized primitive filters and dictionary handling are
intentionally left out of scope.

## Are these changes tested?

Yes.

## Are there any user-facing changes?

No. This is an internal performance optimization only.

<!-- codex-benchmark-start -->
## Local benchmark snapshot

Benchmark command:

```bash
cargo bench -p datafusion-physical-expr --profile release-nonlto --bench in_list_strategy -- --save-baseline <name>
```

Method: compare adjacent saved baselines using raw Criterion sample
minima (`min(time / iters)`). Lower is better; changes within +/-5% are
treated as noise.

Compared baselines: merge-base ->
[apache#21927](apache#21927)

Relevant scope: generic fallback string/view/binary rows.

Summary: 62 relevant rows, 61 faster, 0 slower, 1 within +/-5%.

Largest relevant deltas:

| Benchmark | Before | After | Change |
|---|---:|---:|---:|
| `utf8view/short_8b/list=64/match=0%` | 45.55 us | 21.85 us | -52.0%
(2.08x faster) |
| `utf8view/short_8b/list=256/match=0%` | 44.34 us | 21.71 us | -51.0%
(2.04x faster) |
| `utf8view/short_8b/list=16/match=0%` | 44.03 us | 21.60 us | -50.9%
(2.04x faster) |
| `utf8view/short_8b/list=4/match=0%` | 41.54 us | 20.52 us | -50.6%
(2.02x faster) |
| `utf8view/len_12b/list=16/match=0%` | 41.43 us | 20.55 us | -50.4%
(2.02x faster) |
| `utf8view/len_12b/list=64/match=0%` | 41.59 us | 21.00 us | -49.5%
(1.98x faster) |
| `fixed_size_binary/fsb16/list=10000/match=0%` | 58.11 us | 29.36 us |
-49.5% (1.98x faster) |
| `fixed_size_binary/fsb16/list=256/match=0%` | 55.49 us | 28.57 us |
-48.5% (1.94x faster) |
| `utf8view/shared_prefix/pfx=8/list=16/match=0%` | 57.54 us | 32.07 us
| -44.3% (1.79x faster) |
| `utf8view/mixed_len/list=16/match=0%` | 62.86 us | 35.25 us | -43.9%
(1.78x faster) |
| `fixed_size_binary/fsb16/list=4/match=0%` | 47.62 us | 27.20 us |
-42.9% (1.75x faster) |
| `fixed_size_binary/fsb16/list=64/match=0%` | 47.85 us | 27.45 us |
-42.6% (1.74x faster) |
| `utf8view/mixed_len/list=64/match=0%` | 66.09 us | 38.00 us | -42.5%
(1.74x faster) |
| `utf8/short_8b/list=256/match=0%` | 52.09 us | 30.49 us | -41.5%
(1.71x faster) |
| `utf8view/shared_prefix/pfx=12/list=32/match=0%` | 70.61 us | 42.33 us
| -40.1% (1.67x faster) |

<details>
<summary>Full relevant table (62 rows)</summary>

| Benchmark | Before | After | Change |
|---|---:|---:|---:|
| `fixed_size_binary/fsb16/list=10000/match=0%` | 58.11 us | 29.36 us |
-49.5% (1.98x faster) |
| `fixed_size_binary/fsb16/list=10000/match=50%` | 98.77 us | 81.20 us |
-17.8% (1.22x faster) |
| `fixed_size_binary/fsb16/list=256/match=0%` | 55.49 us | 28.57 us |
-48.5% (1.94x faster) |
| `fixed_size_binary/fsb16/list=256/match=50%` | 96.40 us | 79.32 us |
-17.7% (1.22x faster) |
| `fixed_size_binary/fsb16/list=4/match=0%` | 47.62 us | 27.20 us |
-42.9% (1.75x faster) |
| `fixed_size_binary/fsb16/list=4/match=50%` | 93.08 us | 75.58 us |
-18.8% (1.23x faster) |
| `fixed_size_binary/fsb16/list=64/match=0%` | 47.85 us | 27.45 us |
-42.6% (1.74x faster) |
| `fixed_size_binary/fsb16/list=64/match=50%` | 95.20 us | 74.96 us |
-21.3% (1.27x faster) |
| `nulls/utf8/long_24b/list=16/match=50%/nulls=20%` | 85.74 us | 74.79
us | -12.8% (1.15x faster) |
| `nulls/utf8/short_8b/list=16/match=50%/nulls=20%` | 80.01 us | 77.30
us | -3.4% (within +/-5%) |
| `nulls/utf8view/long_24b/list=16/match=50%/nulls=20%` | 110.19 us |
96.52 us | -12.4% (1.14x faster) |
| `nulls/utf8view/short_8b/list=16/match=50%/nulls=20%` | 74.78 us |
62.92 us | -15.9% (1.19x faster) |
| `nulls/utf8view/short_8b/list=16/match=50%/nulls=20%/NOT_IN` | 71.24
us | 63.51 us | -10.9% (1.12x faster) |
| `nulls/utf8view/short_8b/list=16/match=50%/nulls=50%` | 83.84 us |
62.11 us | -25.9% (1.35x faster) |
| `utf8/long_24b/list=256/match=0%` | 58.79 us | 37.57 us | -36.1%
(1.56x faster) |
| `utf8/long_24b/list=256/match=50%` | 107.85 us | 74.62 us | -30.8%
(1.45x faster) |
| `utf8/long_24b/list=4/match=0%` | 56.68 us | 37.64 us | -33.6% (1.51x
faster) |
| `utf8/long_24b/list=4/match=50%` | 100.40 us | 79.11 us | -21.2%
(1.27x faster) |
| `utf8/long_24b/list=64/match=0%` | 59.39 us | 35.95 us | -39.5% (1.65x
faster) |
| `utf8/long_24b/list=64/match=50%` | 101.26 us | 79.59 us | -21.4%
(1.27x faster) |
| `utf8/mixed_len/list=16/match=0%` | 60.51 us | 49.06 us | -18.9%
(1.23x faster) |
| `utf8/mixed_len/list=16/match=50%` | 154.00 us | 139.13 us | -9.7%
(1.11x faster) |
| `utf8/mixed_len/list=64/match=0%` | 63.46 us | 49.87 us | -21.4%
(1.27x faster) |
| `utf8/mixed_len/list=64/match=50%` | 154.01 us | 134.01 us | -13.0%
(1.15x faster) |
| `utf8/shared_prefix/pfx=12/list=32/match=50%` | 98.73 us | 76.64 us |
-22.4% (1.29x faster) |
| `utf8/short_8b/list=16/match=50%/NOT_IN` | 96.18 us | 72.15 us |
-25.0% (1.33x faster) |
| `utf8/short_8b/list=256/match=0%` | 52.09 us | 30.49 us | -41.5%
(1.71x faster) |
| `utf8/short_8b/list=256/match=50%` | 94.56 us | 74.39 us | -21.3%
(1.27x faster) |
| `utf8/short_8b/list=4/match=0%` | 51.95 us | 32.27 us | -37.9% (1.61x
faster) |
| `utf8/short_8b/list=4/match=50%` | 95.05 us | 78.47 us | -17.4% (1.21x
faster) |
| `utf8/short_8b/list=64/match=0%` | 53.60 us | 33.34 us | -37.8% (1.61x
faster) |
| `utf8/short_8b/list=64/match=50%` | 96.35 us | 80.95 us | -16.0%
(1.19x faster) |
| `utf8view/len_12b/list=16/match=0%` | 41.43 us | 20.55 us | -50.4%
(2.02x faster) |
| `utf8view/len_12b/list=16/match=50%` | 73.07 us | 50.49 us | -30.9%
(1.45x faster) |
| `utf8view/len_12b/list=64/match=0%` | 41.59 us | 21.00 us | -49.5%
(1.98x faster) |
| `utf8view/len_12b/list=64/match=50%` | 75.23 us | 50.25 us | -33.2%
(1.50x faster) |
| `utf8view/long_24b/list=16/match=0%` | 58.48 us | 38.22 us | -34.7%
(1.53x faster) |
| `utf8view/long_24b/list=16/match=50%` | 109.63 us | 87.32 us | -20.4%
(1.26x faster) |
| `utf8view/long_24b/list=256/match=0%` | 61.12 us | 38.40 us | -37.2%
(1.59x faster) |
| `utf8view/long_24b/list=256/match=50%` | 113.25 us | 91.61 us | -19.1%
(1.24x faster) |
| `utf8view/long_24b/list=4/match=0%` | 58.43 us | 39.48 us | -32.4%
(1.48x faster) |
| `utf8view/long_24b/list=4/match=50%` | 112.73 us | 90.14 us | -20.0%
(1.25x faster) |
| `utf8view/long_24b/list=64/match=0%` | 62.17 us | 38.48 us | -38.1%
(1.62x faster) |
| `utf8view/long_24b/list=64/match=50%` | 109.35 us | 87.64 us | -19.8%
(1.25x faster) |
| `utf8view/mixed_len/list=16/match=0%` | 62.86 us | 35.25 us | -43.9%
(1.78x faster) |
| `utf8view/mixed_len/list=16/match=50%` | 126.60 us | 103.97 us |
-17.9% (1.22x faster) |
| `utf8view/mixed_len/list=64/match=0%` | 66.09 us | 38.00 us | -42.5%
(1.74x faster) |
| `utf8view/mixed_len/list=64/match=50%` | 137.76 us | 112.23 us |
-18.5% (1.23x faster) |
| `utf8view/shared_prefix/pfx=12/list=32/match=0%` | 70.61 us | 42.33 us
| -40.1% (1.67x faster) |
| `utf8view/shared_prefix/pfx=12/list=32/match=50%` | 115.15 us | 94.27
us | -18.1% (1.22x faster) |
| `utf8view/shared_prefix/pfx=16/list=64/match=0%` | 63.47 us | 40.67 us
| -35.9% (1.56x faster) |
| `utf8view/shared_prefix/pfx=16/list=64/match=50%` | 112.27 us | 91.32
us | -18.7% (1.23x faster) |
| `utf8view/shared_prefix/pfx=8/list=16/match=0%` | 57.54 us | 32.07 us
| -44.3% (1.79x faster) |
| `utf8view/shared_prefix/pfx=8/list=16/match=50%` | 100.47 us | 82.69
us | -17.7% (1.21x faster) |
| `utf8view/short_8b/list=16/match=0%` | 44.03 us | 21.60 us | -50.9%
(2.04x faster) |
| `utf8view/short_8b/list=16/match=50%` | 72.92 us | 49.10 us | -32.7%
(1.49x faster) |
| `utf8view/short_8b/list=256/match=0%` | 44.34 us | 21.71 us | -51.0%
(2.04x faster) |
| `utf8view/short_8b/list=256/match=50%` | 72.43 us | 51.58 us | -28.8%
(1.40x faster) |
| `utf8view/short_8b/list=4/match=0%` | 41.54 us | 20.52 us | -50.6%
(2.02x faster) |
| `utf8view/short_8b/list=4/match=50%` | 72.50 us | 48.46 us | -33.2%
(1.50x faster) |
| `utf8view/short_8b/list=64/match=0%` | 45.55 us | 21.85 us | -52.0%
(2.08x faster) |
| `utf8view/short_8b/list=64/match=50%` | 73.14 us | 50.92 us | -30.4%
(1.44x faster) |

</details>
<!-- codex-benchmark-end -->
@alamb

alamb commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Thank you very much for doing this in steps -- I will help move them along

I was finding it super challenging to find enough contiguous focus time for this PR. I am feeling very good about the stacked PR approahc -- I'll try and help

alamb added a commit to alamb/datafusion that referenced this pull request Jun 24, 2026
## Which issue does this PR close?

- Part of apache#19241.
- Stacked on apache#21927.
- Next in stack: apache#23012.
- Extracted from apache#19390.

## Rationale for this change

`IN LIST` evaluates expressions like `x IN (1, 3, 7)`. The list on the
right is fixed, so DataFusion can precompute a small lookup structure
once and then reuse it for every input row.

For `UInt8`, there are only 256 possible values: 0 through 255. That
means the lookup can be a tiny checklist with one bit per possible
value:

- If the list contains `3`, set bit `3`.
- If the list contains `7`, set bit `7`.
- To check whether an input value is present, read that one bit.

So instead of hashing each input value or comparing it against the list,
membership becomes one indexed bit test. The bitmap is only 32 bytes,
because 256 bits = 32 bytes.

This PR adds the first specialized primitive path in the stack as a
concrete `UInt8` filter. The `UInt16` version is added in apache#23012, and
the shared bitmap abstraction is introduced only after both concrete
implementations are visible in apache#23035.

## What changes are included in this PR?

- Adds `UInt8BitmapFilter`, a 32-byte bitmap built from the non-null
constants in the `IN` list.
- Routes `UInt8` constant-list filtering to that bitmap path.
- Keeps the same SQL null behavior as the generic path for both `IN` and
`NOT IN`.
- Moves shared dictionary-needle handling into `static_filter.rs`, so
specialized filters can reuse it consistently.
- Adds focused tests for `UInt8` null handling and dictionary-encoded
needles.

## Are these changes tested?

Yes.

- `cargo fmt --all`
- `cargo test -p datafusion-physical-expr bitmap_filter_u8 --lib`
- `cargo test -p datafusion-physical-expr in_list_int_types --lib`
- `cargo clippy -p datafusion-physical-expr --all-targets --all-features
-- -D warnings`

## Are there any user-facing changes?

No. This is an internal performance optimization only.

<!-- codex-benchmark-start -->
## Local benchmark snapshot

Benchmark command:

```bash
cargo bench -p datafusion-physical-expr --profile release-nonlto --bench in_list_strategy -- --save-baseline <name>
```

Method: compare adjacent saved baselines using raw Criterion sample
minima (`min(time / iters)`). Lower is better; changes within +/-5% are
treated as noise. These numbers were not rerun after splitting the
bitmap abstraction into apache#23035.

Compared baselines:
[apache#21927](apache#21927) ->
[apache#23011](apache#23011)

Relevant scope: UInt8 narrow-integer rows.

Summary: 5 relevant rows, 5 faster, 0 slower, 0 within +/-5%.

| Benchmark | Before | After | Change |
|---|---:|---:|---:|
| `narrow_integer/u8/list=16/match=0%` | 20.39 us | 3.94 us | -80.7%
(5.18x faster) |
| `narrow_integer/u8/list=16/match=50%` | 38.38 us | 3.98 us | -89.6%
(9.65x faster) |
| `narrow_integer/u8/list=4/match=0%` | 18.18 us | 3.93 us | -78.4%
(4.62x faster) |
| `narrow_integer/u8/list=4/match=50%` | 34.63 us | 3.96 us | -88.6%
(8.75x faster) |
| `nulls/narrow_integer/u8/list=16/match=50%/nulls=20%` | 37.12 us |
4.16 us | -88.8% (8.93x faster) |
<!-- codex-benchmark-end -->

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
adriangb pushed a commit to pydantic/datafusion that referenced this pull request Jun 26, 2026
## Which issue does this PR close?

- Part of apache#19241.
- Stacked on apache#23011.
- Next in stack: apache#23035.
- Extracted from apache#19390.

## Rationale for this change

apache#23011 uses a bitmap checklist for `UInt8`, where there are 256 possible
values. `UInt16` is the same idea with a larger value range: 0 through
65,535.

That is still small enough to represent directly. A `UInt16` bitmap
needs one bit for each possible value:

- 65,536 possible values
- 65,536 bits total
- 8 KB of memory

Then a lookup is still simple: use the input value as the bit position
and check whether that bit is set. For example, if the list contains
`42`, bit `42` is set, and every input row with value `42` can be
recognized with one bit test.

This PR keeps the scope narrow: it adds the unsigned 2-byte bitmap path
as a concrete `UInt16` filter. apache#23035 then unifies the `UInt8` and
`UInt16` implementations, and apache#23013 uses that shared shape for signed
same-width reinterpretation.

## What changes are included in this PR?

- Adds `UInt16BitmapFilter`, backed by a heap-allocated 65,536-bit
bitmap.
- Routes `UInt16` constant-list filtering to that bitmap path.
- Keeps the same `IN` / `NOT IN` null behavior as the generic path.
- Adds focused coverage for `UInt16` boundary values, nulls, and `NOT
IN`.

## Are these changes tested?

Yes.

- `cargo fmt --all`
- `cargo test -p datafusion-physical-expr bitmap_filter_u16 --lib`
- `cargo test -p datafusion-physical-expr in_list_int_types --lib`
- `cargo test -p datafusion-physical-expr
test_in_list_from_array_type_combinations --lib`
- `cargo test -p datafusion-physical-expr test_in_list_dictionary_types
--lib`
- `cargo clippy -p datafusion-physical-expr --all-targets --all-features
-- -D warnings`

## Are there any user-facing changes?

No. This is an internal performance optimization only.

<!-- codex-benchmark-start -->
## Benchmark note

No local `in_list_strategy` numbers are included for this PR because the
benchmark harness does not currently include a direct `UInt16` case. The
available `i16` rows measure the signed reinterpretation path added in
apache#23013 after the bitmap unification in apache#23035, not this PR's unsigned
`UInt16` bitmap filter.
<!-- codex-benchmark-end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Make DataFusion faster physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants