Skip to content

perf: fast_regex: store literal needles in an Arc - #604

Merged
sylvestre merged 2 commits into
uutils:mainfrom
Omkar-Wagholikar:perf/literal-needle-arc
Oct 18, 2026
Merged

sylvestre merged 2 commits into
uutils:mainfrom
Omkar-Wagholikar:perf/literal-needle-arc

Conversation

@Omkar-Wagholikar

@Omkar-Wagholikar Omkar-Wagholikar commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

re_or_saved_re() (src/sed/processor.rs:192) copies the regex for every input line. With an Arc<[u8]>, that copy shares the existing pattern instead of allocating a new one.

I have not added tests specifically for this change as there is not net behavior change only a perf update, and the existing tests cover the changes as well

re_or_saved_re() (src/sed/processor.rs:192) copies the regex for every
input line. With an Arc<[u8]>, that copy shares the existing pattern
instead of allocating a new one.
@Omkar-Wagholikar Omkar-Wagholikar changed the title fast_regex: store literal needles in an Arc pref: fast_regex: store literal needles in an Arc Oct 15, 2026
@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.85%. Comparing base (58608af) to head (2fc8b9d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #604   +/-   ##
=======================================
  Coverage   94.85%   94.85%           
=======================================
  Files          14       14           
  Lines        7230     7230           
  Branches      432      432           
=======================================
  Hits         6858     6858           
  Misses        371      371           
  Partials        1        1           
Flag Coverage Δ
macos_latest 96.39% <100.00%> (ø)
ubuntu_latest 96.33% <100.00%> (ø)
windows_latest 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@codspeed

codspeed Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ 1 benchmark spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 6 improved benchmarks
❌ 1 regressed benchmark
✅ 4 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ number_fix 1.2 s 1.3 s -3.62%
⚡ remove_cr 502.9 ms 432.7 ms +16.23%
⚡ access_log_no_del 1,042.8 ms 900 ms +15.88%
⚡ access_log_no_subst 1,052.1 ms 908.8 ms +15.77%
⚡ access_log_all_del 1,075 ms 932.2 ms +15.33%
⚡ genome_subst 432.1 ms 389.9 ms +10.83%
⚡ access_log_subst 2.2 s 2.2 s +3.14%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing Omkar-Wagholikar:perf/literal-needle-arc (2fc8b9d) with main (58608af)

Open in CodSpeed

@sylvestre sylvestre changed the title pref: fast_regex: store literal needles in an Arc perf: fast_regex: store literal needles in an Arc Oct 18, 2026
@sylvestre
sylvestre merged commit 3b464d1 into uutils:main Oct 18, 2026
30 of 31 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants