Skip to content

perf: Use bulk-NULL builder in replace#21849

Open
neilconway wants to merge 1 commit intoapache:mainfrom
neilconway:neilc/perf-builder-replace
Open

perf: Use bulk-NULL builder in replace#21849
neilconway wants to merge 1 commit intoapache:mainfrom
neilconway:neilc/perf-builder-replace

Conversation

@neilconway
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

We can use the new bulk-NULL string builder APIs to reduce NULL handling overhead in replace. There is a further opportunity for optimization once arrow/arrow-rs#9692 lands.

Benchmarks:

  • replace size=1024/replace_string_ascii_single [str_len=32]: 17.42 µs → 14.35 µs, −17.71%
  • replace size=1024/replace_string_view [str_len=32]: 21.23 µs → 18.89 µs, −11.05%
  • replace size=1024/replace_string [str_len=32]: 20.42 µs → 18.51 µs, −9.36%
  • replace size=1024/replace_large_string [str_len=32]: 20.83 µs → 18.42 µs, −11.60%
  • replace size=1024/replace_string_ascii_single [str_len=128]: 10.61 µs → 10.37 µs, −2.22%
  • replace size=1024/replace_string_view [str_len=128]: 28.37 µs → 28.03 µs, −1.21%
  • replace size=1024/replace_string [str_len=128]: 27.96 µs → 28.03 µs, +0.25% (noise)
  • replace size=1024/replace_large_string [str_len=128]: 28.15 µs → 27.95 µs, −0.70% (noise)
  • replace size=4096/replace_string_ascii_single [str_len=32]: 68.40 µs → 56.15 µs, −17.94%
  • replace size=4096/replace_string_view [str_len=32]: 85.95 µs → 76.84 µs, −10.61%
  • replace size=4096/replace_string [str_len=32]: 82.79 µs → 74.71 µs, −9.76%
  • replace size=4096/replace_large_string [str_len=32]: 85.32 µs → 75.14 µs, −11.94%
  • replace size=4096/replace_string_ascii_single [str_len=128]: 38.35 µs → 39.10 µs, +1.96% (small regression)
  • replace size=4096/replace_string_view [str_len=128]: 132.77 µs → 128.08 µs, −3.53%
  • replace size=4096/replace_string [str_len=128]: 127.71 µs → 128.29 µs, +0.46% (noise)
  • replace size=4096/replace_large_string [str_len=128]: 131.97 µs → 128.68 µs, −2.49%

What changes are included in this PR?

  • Use bulk-NULL string builders in replace

Are these changes tested?

Yes, covered by existing tests.

Are there any user-facing changes?

No.

@github-actions github-actions Bot added the functions Changes to functions implementation label Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize replace to use bulk-NULL string builder

1 participant