Skip to content

perf(arrow-row): skip the per-element probe when decoding FixedSizeList of fixed-width values - #12540

Open
Mukunth1004 wants to merge 4 commits into
apache:mainfrom
Mukunth1004:fix/12537-fixed-size-list-row-decode
Open

Mukunth1004 wants to merge 4 commits into
apache:mainfrom
Mukunth1004:fix/12537-fixed-size-list-row-decode

Conversation

@Mukunth1004

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

decode_fixed_size_list finds where each element of a valid row ends by
decoding it into a throwaway one-row array (convert_raw per element). For a
FixedSizeList(Float32, 768) that is 768 array builds per row. For element
types whose row encoding has a fixed width, every element (null or not) is as
long as the encoded null element the function already computes, so the probe
is not needed.

What changes are included in this PR?

Two commits:

  1. chore(arrow): adds row_format benchmarks for FixedSizeList (f32 x 8 and
    f32 x 768, plus utf8 x 8 as a variable-width control). Use this commit as
    baseline.ref.
  2. perf(arrow-row): when the element type is primitive, Boolean, Null or
    FixedSizeBinary, cut each valid row into value_length chunks of the
    null element's encoded width with chunks_exact, and size child_rows
    up front. Other element types keep the existing loop.
    No public API change.

The variable-width path (the issue's second suggestion) is left for a separate PR.

Are these changes tested?

Existing FixedSizeList tests exercise the new path (Int32, Null, two adjacent
lists). Added test_fixed_size_list_of_fixed_width_values, which round-trips
Boolean, Float32 (incl. NaN and -0.0), Decimal128, FixedSizeBinary and Null
elements with list-level and element-level nulls, under all four sort option
combinations, followed by a second column to check the row is advanced
correctly.

Benchmarks (cargo bench -p arrow --features test_utils --bench row_format -- "convert_rows .*fixed_size_list",
local Linux machine, shared, so expect some noise):

benchmark before after change
convert_rows 4096 fixed_size_list(8) of f32(0) 6.23 ms 123 µs -98.0%
convert_rows 1024 fixed_size_list(768) of f32(0) 153.5 ms 5.57 ms -96.4%
convert_rows 4096 fixed_size_list(8) of utf8(10, 0) 9.21 ms 9.18 ms no change

No input gets slower: variable-width elements take the unchanged path.

Are there any significant user-facing changes?

No.

AI usage disclosure

Claude Code assisted with investigating the issue and developing the implementation and tests. I reviewed the changes, verified the test results and benchmarks, and understand the implementation. I'll take responsibility for addressing review feedback and maintaining this contribution.

…st of fixed-width values

decode_fixed_size_list worked out where each element ends by decoding it
into a one-row array. Primitive, boolean, null and fixed size binary
values all encode to the same length as the null element we already
build, so for those types just cut the row into chunks of that width.

Closes apache#12537
@Rich-T-kid

Copy link
Copy Markdown
Contributor

run benchmark row_format
env:
BENCH_FILTER: "^convert_rows .*fixed_size_list"
baseline:
ref: "bfc4f2af8c0bcbe116b41d8746c4f3eef2b18b9d"
changed:
ref: "5920f0548dd0a18f3aab147b54f5094e733f6d87"

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark starting (GKE) | trigger

Target: row_format

Sharding factor: 1 (1 workers).

Comparing 5920f05 (5920f05) to bfc4f2a diff

Run configuration
run benchmark row_format
baseline:
  ref: bfc4f2af8c0bcbe116b41d8746c4f3eef2b18b9d
changed:
  ref: 5920f0548dd0a18f3aab147b54f5094e733f6d87
env:
  BENCH_FILTER: ^convert_rows .*fixed_size_list
shards: 1
Trigger comment
run benchmark row_format
env:
  BENCH_FILTER: "^convert_rows .*fixed_size_list"
baseline:
  ref: "bfc4f2af8c0bcbe116b41d8746c4f3eef2b18b9d"
changed:
  ref: "5920f0548dd0a18f3aab147b54f5094e733f6d87"

Results will be posted when all workers finish.


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Target: row_format

Comparing 5920f05 (5920f05) to bfc4f2a diff

Run configuration
run benchmark row_format
baseline:
  ref: bfc4f2af8c0bcbe116b41d8746c4f3eef2b18b9d
changed:
  ref: 5920f0548dd0a18f3aab147b54f5094e733f6d87
env:
  BENCH_FILTER: ^convert_rows .*fixed_size_list
shards: 1
Trigger comment
run benchmark row_format
env:
  BENCH_FILTER: "^convert_rows .*fixed_size_list"
baseline:
  ref: "bfc4f2af8c0bcbe116b41d8746c4f3eef2b18b9d"
changed:
  ref: "5920f0548dd0a18f3aab147b54f5094e733f6d87"
Details
group                                                  base                                   changed
-----                                                  ----                                   -------
convert_rows 1024 fixed_size_list(768) of f32(0)       92.34   193.9±7.40ms        ? ?/sec    1.00      2.1±0.01ms        ? ?/sec
convert_rows 4096 fixed_size_list(8) of f32(0)         78.39     7.9±0.06ms        ? ?/sec    1.00    100.3±0.18µs        ? ?/sec
convert_rows 4096 fixed_size_list(8) of utf8(10, 0)    1.00     10.7±0.11ms        ? ?/sec    1.00     10.8±0.13ms        ? ?/sec

Per-runner information
row_format — shard 1/1

Node: gk3-benchmark-cluster-nap-14njlul2-a02a5789-2fpw

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

uname:

Linux bench-c7381958161-6172-6fbxm 6.12.105+ #1 SMP Sat Sep 19 07:55:25 UTC 2026 aarch64 GNU/Linux

BENCH_COMMAND:

cargo bench --features=arrow,async,test_common,experimental,object_store --bench row_format
CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Resource Usage

base (merge-base)

Metric Value
Wall time 50.0s
Peak memory 38.5 MiB
Avg memory 24.0 MiB
CPU user 45.8s
CPU sys 0.1s
Peak spill 0 B

branch

Metric Value
Wall time 30.0s
Peak memory 38.4 MiB
Avg memory 28.3 MiB
CPU user 28.0s
CPU sys 0.0s
Peak spill 0 B

File an issue against this benchmark runner

@Mukunth1004

Mukunth1004 commented Dec 3, 2026 •

Copy link
Copy Markdown
Author

Thanks for running the benchmark @Rich-T-kid! The CI numbers are even better than what I measured locally (78x vs ~51x for 8 elements, 92x vs ~28x for 768), and utf8 is unchanged as expected.

Whenever a maintainer has a moment, could someone approve the CI workflow run? It's my first PR here, so it's waiting on approval. Happy to address any review feedback.

@Rich-T-kid Rich-T-kid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

benchmarks look strong & the PR makes sense to me

@Rich-T-kid

Copy link
Copy Markdown
Contributor

@Mukunth1004 can you enable the CI on your fork

@Mukunth1004

Copy link
Copy Markdown
Author

Done, I've enabled CI on my fork and started a run on this branch. Thanks for the review @Rich-T-kid !

@Mukunth1004

Copy link
Copy Markdown
Author

Pushed a one-line test fix: typos flagged the fixture string b"abd", swapped it for b"abx". Fork CI re-running. @Rich-T-kid

@Mukunth1004

Copy link
Copy Markdown
Author

Fork CI can't start here: the jobs fail with "The job was not acquired by Runner of type hosted even after multiple attempts" (the workflow uses ubuntu-slim). Locally typos, cargo fmt --check, clippy -D warnings for arrow-row/arrow, and the arrow-row tests all pass. Could a maintainer approve the upstream workflow run instead?
@Rich-T-kid

@Rich-T-kid

Copy link
Copy Markdown
Contributor

running workflow

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow-core Core crates related to representing arrow data arrow-row arrow-row crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arrow-row: decode_fixed_size_list builds an array per element, so decoding FixedSizeList rows is O(n) allocations per row

3 participants