Skip to content

refactor: share hex encoding across datafusion-common, functions, and spark#23766

Open
andygrove wants to merge 8 commits into
apache:mainfrom
andygrove:auto-opt/to_hex-datafusion-20260721-094849
Open

refactor: share hex encoding across datafusion-common, functions, and spark#23766
andygrove wants to merge 8 commits into
apache:mainfrom
andygrove:auto-opt/to_hex-datafusion-20260721-094849

Conversation

@andygrove

@andygrove andygrove commented Jul 21, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

N/A

Rationale for this change

Hex encoding was implemented six times across the workspace, at two different levels of optimization.

Three copies used a fast byte-pair lookup table:

  • datafusion/spark/src/function/math/hex.rs
  • datafusion/functions/src/string/to_hex.rs
  • datafusion/functions/src/encoding/inner.rs (via the hex crate)

The other three used a slower nibble-at-a-time loop pushing one character at a time:

  • datafusion/functions/src/crypto/md5.rs
  • datafusion/spark/src/function/hash/sha1.rs
  • datafusion/spark/src/function/hash/sha2.rs

Beyond the duplication, this split meant the digest functions were paying for a slower encoder
than the one already sitting elsewhere in the tree. Consolidating on a single implementation
removes the duplication and moves md5, sha1, and sha2 onto the fast path.

What changes are included in this PR?

A new datafusion_common::utils::hex module holds the only hex encoder in the workspace:

pub enum HexCase { Lower, Upper }

pub fn encode_bytes_into(bytes: &[u8], case: HexCase, out: &mut Vec<u8>);
pub fn encode_bytes(bytes: &[u8], case: HexCase) -> String;
pub fn encode_bytes_to_slice(bytes: &[u8], case: HexCase, out: &mut [u8]);
pub fn encode_u64(v: u64, case: HexCase, buf: &mut [u8; 16]) -> &[u8];

Four entry points rather than one because the call sites have genuinely different output needs,
and forcing them through a single shape would cost an allocation somewhere: to_hex writes
straight into a StringArray values buffer, Spark's hex appends to a reused scratch Vec,
encode writes into a pre-sized slice, and the digest functions want an owned String.

Migrated call sites, all producing bit-identical output:

File Change
functions/src/string/to_hex.rs local table and two write helpers deleted; eight trait impls collapsed to two macros
spark/src/function/math/hex.rs two nibble tables, two lookup tables, build_hex_lookup and hex_int64 deleted
functions/src/crypto/md5.rs local table and hex_encode deleted
spark/src/function/hash/sha1.rs local table and inline nibble loop deleted
spark/src/function/hash/sha2.rs local table and hex_encode deleted; eight call sites migrated
functions/src/encoding/inner.rs both encode sites moved off the hex crate

Deliberately left alone:

  • hex::decode / hex::decode_to_slice in encoding/inner.rs, and Spark's unhex. The decode
    direction has different semantics — Spark's unhex left-pads odd-length input, the hex crate
    does not — so unifying it is a separate question. The hex dependency stays for those.
  • ScalarValue's binary Display impl in common/src/scalar/mod.rs, which writes to a
    fmt::Formatter rather than a byte buffer, and is a cold path.

Three details worth a reviewer's attention:

  • The two ancestors of encode_u64 disagreed on zero: to_hex wrote '0' into the caller's
    buffer, Spark's hex_int64 returned a 'static b"0" that never touched it. The shared version
    always writes into the buffer and returns a subslice of it, so the lifetime is uniform. Both
    callers still produce "0".
  • Spark's hex_encode_bytes guards large binary input with checked_mul(2) + try_reserve,
    returning a DataFusionError rather than aborting on allocation failure. That guard stays at the
    call site; encode_bytes_into performs no reservation of its own, so behaviour is unchanged.
  • The encoders are #[inline(always)], not #[inline]. They are called once per row from two
    other crates, and plain #[inline] left them out-of-line across the crate boundary. Measured
    cost of that: +3% on Spark's byte paths and up to +18% on to_hex's i32 path, i.e. the
    refactor was a net regression on those benchmarks until the attribute changed.

Are these changes tested?

Every migrated function keeps its existing unit and sqllogictest coverage, which is what pins
bit-identical output — in particular spark/hash/sha1.slt and sha2.slt assert concrete digest
strings for all four SHA-2 bit lengths across both the scalar and array paths, and expr.slt
covers to_hex and md5.

New unit tests in common/src/utils/hex.rs cover zero, u64::MAX, single-nibble values, the
odd/even digit-count boundary, two's complement of negative input, empty input, all 256 byte
values in both cases, appending into a non-empty buffer, and that a reused scratch buffer never
leaks stale digits between calls. Tests cross-check against format!("{:x}") rather than
restating the implementation.

Two Spark tests changed. test_hex_int64 now drives hex_encode_int64 instead of the deleted
private hex_int64, keeping all ten cases including i64::MIN, -1, and the uppercase
expectations. test_hex_lookup_table_covers_all_bytes was deleted — it only cross-checked the raw
lookup tables, and encode_bytes_covers_every_byte_value now does that exhaustively through the
public API. A test was added for Spark's lowercase byte path, which previously had no coverage.

Benchmarks

Criterion, apache/main @ eef101769 as baseline. Median of the reported change interval.

datafusion/functions/benches/to_hex.rs:

Benchmark 1024 4096 8192
i32_random −13.8% −12.8% −10.2%
i64_random −8.8% −9.5% −8.1%
i64_large_values −9.9% −9.8% −7.9%

scalar_i32 −2.3%, scalar_i64 −1.8%.

datafusion/spark/benches/sha2.rs:

Benchmark 1024 4096 8192
array_binary_256 −20.7% −18.2% −19.1%
array_scalar_binary_256 −14.6% −13.2% −13.1%

scalar/size=1 −3.3%.

datafusion/spark/benches/hex.rs:

Benchmark 1024 4096 8192
hex_int64 −2.9% −3.6% −3.5%
hex_int64_dict −3.2% −1.5% −0.2%
hex_utf8 −0.2% −0.3% +0.7%
hex_binary −0.4% −0.6% −0.3%

The hex_utf8 and hex_binary paths already used the byte-pair table before this PR, so they are
expected to be flat; they are.

datafusion/functions/benches/crypto.rs: md5_array −4.0%, md5_scalar −3.7%. The sha224 /
sha256 / sha384 / sha512 cases in that file range from −0.1% to +2.2%, but they exercise
crypto/basic.rs, which this PR does not modify and which contains no hex encoding — those numbers
are run-to-run variance, not an effect of this change.

No number is quoted for Spark sha1: it has no benchmark, and its change is the same substitution
applied to md5 and sha2.

Are there any user-facing changes?

No behaviour change — all migrated functions produce byte-identical output.

datafusion_common::utils::hex is new public API on datafusion-common.

@github-actions github-actions Bot added the functions Changes to functions implementation label Jul 21, 2026
@codecov-commenter

codecov-commenter commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.89796% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.71%. Comparing base (eef1017) to head (5e7e211).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
datafusion/common/src/utils/hex.rs 93.37% 10 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #23766   +/-   ##
=======================================
  Coverage   80.71%   80.71%           
=======================================
  Files        1089     1090    +1     
  Lines      368748   368814   +66     
  Branches   368748   368814   +66     
=======================================
+ Hits       297633   297691   +58     
- Misses      53372    53378    +6     
- Partials    17743    17745    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@andygrove andygrove changed the title perf: optimize to_hex in datafusion-functions perf: optimize to_hex in datafusion-functions [WIP] Jul 21, 2026
Migrate the Spark-compatible hex function onto the shared
datafusion_common::utils::hex module (encode_bytes_into, encode_u64)
instead of its own lookup tables, keeping the post-apache#23473 buffer
structure (manual value/offset buffers, try_reserve guard,
StringArray::new_unchecked) unchanged.
Replace the per-file hex-encoding lookup tables in Spark's sha1 and
sha2 functions with the shared datafusion_common::utils::hex module,
continuing the consolidation started for to_hex, hex, and md5.
Add encode_bytes_to_slice to the shared hex module for callers writing
into a pre-sized buffer, and migrate the encode() scalar function's
last two hex call sites (inner.rs) off the hex crate onto it. This
closes the API gap that had left hex_encode_array as the final
divergent hex encoder in the workspace.
Reword the write_digits doc comment to describe the actual borrow
conflict (the v == 0 early return, not a return inside the loop),
drop the unreachable & 0xF mask in build_lookup, add doctests to the
public encode_bytes/encode_u64/encode_bytes_to_slice functions plus a
less internal module doc comment, replace the tautological
encode_bytes/encode_bytes_into agreement test with one that pins
buffer-reuse behavior in encode_u64, and cover the untested lowercase
path of hex_encode_bytes in the Spark hex function.
@andygrove
andygrove force-pushed the auto-opt/to_hex-datafusion-20260721-094849 branch from d791b9a to 60a69fd Compare July 21, 2026 20:37
@github-actions github-actions Bot added common Related to common crate spark labels Jul 21, 2026
@andygrove andygrove changed the title perf: optimize to_hex in datafusion-functions [WIP] refactor: share hex encoding across datafusion-common, functions, and spark Jul 21, 2026
The encode entry points are called once per row from datafusion-functions
and datafusion-spark. Plain #[inline] left them out-of-line across the
crate boundary, which cost 2-3% on Spark's byte paths and up to 18% on
to_hex's i32 path relative to the pre-refactor local implementations.
@andygrove
andygrove requested review from Jefffrey and alamb July 21, 2026 22:14
@andygrove
andygrove marked this pull request as ready for review July 21, 2026 22:14
@andygrove
andygrove requested a review from comphead July 21, 2026 22:14
@andygrove andygrove added the performance Make DataFusion faster label Jul 21, 2026

@alamb alamb 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.

Looks good to me -- thank you @andygrove

I wonder if we have something similar with base64 🤔

debug_assert_eq!(out.len(), bytes.len() * 2);
let lookup = case.lookup();
for (&b, chunk) in bytes.iter().zip(out.chunks_exact_mut(2)) {
chunk.copy_from_slice(&lookup[b as usize]);

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.

this is probably going to be quite fast

/// pre-allocated output array) and want to write directly into it rather
/// than appending to a `Vec`.
///
/// The length requirement is only checked in debug builds, via

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.

Why not just check it and return an internal error? It seems better than a silent failure in release builds

Comment on lines +165 to +168
/// returned slice reborrows it. The `v == 0` case returns early; if that early
/// return instead reborrowed `buf` as `&buf[..]` inline in [`encode_u64`], the
/// borrow checker would extend that reborrow over the rest of the function
/// body, conflicting with the mutable writes on the non-zero path below.

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.

I think it would be enough here to describe the borrow checker and not try to summarize the implementation detail too

Suggested change
/// returned slice reborrows it. The `v == 0` case returns early; if that early
/// return instead reborrowed `buf` as `&buf[..]` inline in [`encode_u64`], the
/// borrow checker would extend that reborrow over the rest of the function
/// body, conflicting with the mutable writes on the non-zero path below.
/// returned slice reborrows it.

/// assert_eq!(encode_bytes(&[0xde, 0xad, 0xbe, 0xef], HexCase::Upper), "DEADBEEF");
/// ```
#[inline]
pub fn encode_bytes(bytes: &[u8], case: HexCase) -> String {

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.

I think this function will perform poorly as it allocates -- it might be a good idea as a follow on PR to remove. this function and rewrite any uses of it so they don't allocate a bunch of strings

binary_array.iter().map(|opt| opt.map(hex_encode)).collect();
let string_array: StringViewArray = binary_array
.iter()
.map(|opt| opt.map(|b| encode_bytes(b, HexCase::Lower)))

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.

This is unfortunate (as it makes a bunch of allocated strings and then copies them again into theStringViewArray -- using a temporary buffer ald a stringViewBuilder could avoid the intermediate allocation

This can be done as a follow on PR (or never) -- the old version dod this too


/// Converts the number to its equivalent hexadecimal representation.
/// to_hex(2147483647) = '7fffffff'
fn to_hex_array<T: ArrowPrimitiveType>(array: &ArrayRef) -> Result<ArrayRef>

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.

here is an good example of creating StringArrays directly with hex

unsafe { std::str::from_utf8_unchecked(hex).to_string() }
}

/// Trait for converting integer types to hexadecimal in a buffer

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.

I wonder if we should move this code into the common library crate as well

@alamb

alamb commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

run benchmarks to_hex hex sha2 crypto

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c5041334503-1216-vcnrm 6.12.85+ #1 SMP Mon May 11 08:17:35 UTC 2026 aarch64 GNU/Linux

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

Comparing auto-opt/to_hex-datafusion-20260721-094849 (5e7e211) to eef1017 (merge-base) diff using: to_hex
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c5041334503-1219-9h47g 6.12.85+ #1 SMP Mon May 11 08:17:35 UTC 2026 aarch64 GNU/Linux

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

Comparing auto-opt/to_hex-datafusion-20260721-094849 (5e7e211) to eef1017 (merge-base) diff using: crypto
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c5041334503-1218-wk5xp 6.12.85+ #1 SMP Mon May 11 08:17:35 UTC 2026 aarch64 GNU/Linux

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

Comparing auto-opt/to_hex-datafusion-20260721-094849 (5e7e211) to eef1017 (merge-base) diff using: sha2
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c5041334503-1217-72glc 6.12.85+ #1 SMP Mon May 11 08:17:35 UTC 2026 aarch64 GNU/Linux

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

Comparing auto-opt/to_hex-datafusion-20260721-094849 (5e7e211) to eef1017 (merge-base) diff using: hex
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

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
Details

group            HEAD                                   auto-opt_to_hex-datafusion-20260721-094849
-----            ----                                   ------------------------------------------
md5_array        1.09    125.1±5.89µs        ? ?/sec    1.00    114.7±0.88µs        ? ?/sec
md5_scalar       1.02    323.8±3.34ns        ? ?/sec    1.00    318.9±0.86ns        ? ?/sec
sha224_array     1.00     55.7±0.30µs        ? ?/sec    1.00     55.6±0.32µs        ? ?/sec
sha224_scalar    1.00    231.1±2.33ns        ? ?/sec    1.00    231.3±2.38ns        ? ?/sec
sha256_array     1.00     54.7±0.25µs        ? ?/sec    1.00     54.5±0.27µs        ? ?/sec
sha256_scalar    1.00    231.8±2.62ns        ? ?/sec    1.04    240.9±2.74ns        ? ?/sec
sha384_array     1.00    113.2±0.62µs        ? ?/sec    1.00    113.2±0.60µs        ? ?/sec
sha384_scalar    1.01    315.5±2.86ns        ? ?/sec    1.00    313.1±2.25ns        ? ?/sec
sha512_array     1.00    119.6±0.19µs        ? ?/sec    1.00    119.1±0.19µs        ? ?/sec
sha512_scalar    1.01    315.8±3.19ns        ? ?/sec    1.00    311.7±2.88ns        ? ?/sec

Resource Usage

crypto — base (merge-base)

Metric Value
Wall time 225.0s
Peak memory 31.9 MiB
Avg memory 11.4 MiB
CPU user 118.6s
CPU sys 0.1s
Peak spill 0 B

crypto — branch

Metric Value
Wall time 260.1s
Peak memory 26.9 MiB
Avg memory 8.7 MiB
CPU user 119.0s
CPU sys 0.1s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

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
Details

group                                HEAD                                   auto-opt_to_hex-datafusion-20260721-094849
-----                                ----                                   ------------------------------------------
to_hex size=1024/i32_random          1.09      9.3±0.28µs        ? ?/sec    1.00      8.6±0.24µs        ? ?/sec
to_hex size=1024/i64_large_values    1.05     10.0±0.36µs        ? ?/sec    1.00      9.5±0.34µs        ? ?/sec
to_hex size=1024/i64_random          1.06     10.0±0.35µs        ? ?/sec    1.00      9.5±0.33µs        ? ?/sec
to_hex size=4096/i32_random          1.06     35.4±1.12µs        ? ?/sec    1.00     33.4±0.97µs        ? ?/sec
to_hex size=4096/i64_large_values    1.06     39.3±1.45µs        ? ?/sec    1.00     37.0±1.35µs        ? ?/sec
to_hex size=4096/i64_random          1.06     39.2±1.38µs        ? ?/sec    1.00     37.1±1.33µs        ? ?/sec
to_hex size=8192/i32_random          1.07     72.4±2.04µs        ? ?/sec    1.00     67.7±1.89µs        ? ?/sec
to_hex size=8192/i64_large_values    1.06     78.5±3.83µs        ? ?/sec    1.00     73.8±2.69µs        ? ?/sec
to_hex size=8192/i64_random          1.05     78.3±2.74µs        ? ?/sec    1.00     74.2±2.60µs        ? ?/sec
to_hex/scalar_i32                    1.02    116.1±2.93ns        ? ?/sec    1.00    113.9±1.70ns        ? ?/sec
to_hex/scalar_i64                    1.02    117.4±2.38ns        ? ?/sec    1.00    115.3±1.77ns        ? ?/sec

Resource Usage

to_hex — base (merge-base)

Metric Value
Wall time 320.1s
Peak memory 27.6 MiB
Avg memory 11.6 MiB
CPU user 167.4s
CPU sys 0.1s
Peak spill 0 B

to_hex — branch

Metric Value
Wall time 275.1s
Peak memory 28.5 MiB
Avg memory 14.2 MiB
CPU user 172.3s
CPU sys 0.1s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

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
Details

group                                     HEAD                                   auto-opt_to_hex-datafusion-20260721-094849
-----                                     ----                                   ------------------------------------------
sha2/array_binary_256/size=1024           1.17    136.3±0.40µs        ? ?/sec    1.00    116.4±0.35µs        ? ?/sec
sha2/array_binary_256/size=4096           1.16    544.5±1.68µs        ? ?/sec    1.00    468.0±1.23µs        ? ?/sec
sha2/array_binary_256/size=8192           1.15   1085.3±3.56µs        ? ?/sec    1.00    940.8±2.63µs        ? ?/sec
sha2/array_scalar_binary_256/size=1024    1.16    135.7±0.17µs        ? ?/sec    1.00    117.2±0.17µs        ? ?/sec
sha2/array_scalar_binary_256/size=4096    1.15    542.0±0.69µs        ? ?/sec    1.00    470.1±0.80µs        ? ?/sec
sha2/array_scalar_binary_256/size=8192    1.14   1081.3±1.54µs        ? ?/sec    1.00    947.5±1.66µs        ? ?/sec
sha2/scalar/size=1                        1.09    249.7±0.40ns        ? ?/sec    1.00    229.8±0.72ns        ? ?/sec

Resource Usage

sha2 — base (merge-base)

Metric Value
Wall time 430.1s
Peak memory 32.2 MiB
Avg memory 4.3 MiB
CPU user 84.9s
CPU sys 0.1s
Peak spill 0 B

sha2 — branch

Metric Value
Wall time 430.1s
Peak memory 30.7 MiB
Avg memory 4.7 MiB
CPU user 92.3s
CPU sys 0.1s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

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

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
Details

group                       HEAD                                   auto-opt_to_hex-datafusion-20260721-094849
-----                       ----                                   ------------------------------------------
hex_binary/size=1024        1.00     34.4±0.06µs        ? ?/sec    1.00     34.2±0.05µs        ? ?/sec
hex_binary/size=4096        1.01    145.5±0.32µs        ? ?/sec    1.00    144.7±0.21µs        ? ?/sec
hex_binary/size=8192        1.01    285.0±0.56µs        ? ?/sec    1.00    283.1±0.42µs        ? ?/sec
hex_int64/size=1024         1.00      8.8±0.03µs        ? ?/sec    1.02      9.0±0.03µs        ? ?/sec
hex_int64/size=4096         1.00     33.7±0.11µs        ? ?/sec    1.01     34.2±0.10µs        ? ?/sec
hex_int64/size=8192         1.01     69.6±0.28µs        ? ?/sec    1.00     68.7±0.28µs        ? ?/sec
hex_int64_dict/size=1024    1.00      8.8±0.01µs        ? ?/sec    1.02      9.0±0.02µs        ? ?/sec
hex_int64_dict/size=4096    1.00     33.6±0.07µs        ? ?/sec    1.00     33.7±0.08µs        ? ?/sec
hex_int64_dict/size=8192    1.00     67.0±0.11µs        ? ?/sec    1.00     67.1±0.12µs        ? ?/sec
hex_utf8/size=1024          1.00     34.3±0.05µs        ? ?/sec    1.00     34.3±0.14µs        ? ?/sec
hex_utf8/size=4096          1.01    145.6±0.16µs        ? ?/sec    1.00    144.8±0.22µs        ? ?/sec
hex_utf8/size=8192          1.00    285.3±0.26µs        ? ?/sec    1.00    284.4±0.33µs        ? ?/sec

Resource Usage

hex — base (merge-base)

Metric Value
Wall time 470.1s
Peak memory 29.9 MiB
Avg memory 6.6 MiB
CPU user 150.7s
CPU sys 0.1s
Peak spill 0 B

hex — branch

Metric Value
Wall time 430.1s
Peak memory 29.8 MiB
Avg memory 7.0 MiB
CPU user 147.4s
CPU sys 0.1s
Peak spill 0 B

File an issue against this benchmark runner

@alamb

alamb commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Bench results look good

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

Labels

common Related to common crate functions Changes to functions implementation performance Make DataFusion faster spark

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants