Skip to content

ptx: add benchmark - #13480

Merged
sylvestre merged 7 commits into
uutils:mainfrom
Aisha630:ptx-add-benchmark
Aug 13, 2026
Merged

ptx: add benchmark#13480
sylvestre merged 7 commits into
uutils:mainfrom
Aisha630:ptx-add-benchmark

Conversation

@Aisha630

@Aisha630 Aisha630 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

ptx: add benchmark

Summary

I'm adding Divan benchmarks for ptx.

This is a benchmark-only change. No utility code is touched.

Why

ptx had no benchmark. Its cost is dominated by converting keyword byte offsets to character offsets while building the output, which grows with the line length. So the benchmarks hold the total input size roughly constant and vary the line length, which is what surfaces that behavior. It also gives us a baseline to measure the offset-conversion optimization I'm proposing separately.

Benchmarks

Bench Args Covers
ptx_short_lines 100_000 lines many short lines
ptx_long_lines 100 lines fixed ~1 MiB spread over fewer, longer lines
ptx_input_references_short_lines 100_000 lines -r , short lines
ptx_input_references_long_lines 100 lines -r on fewer, longer lines

I followed the guidelines in the performance.md file and drew inspiration from the tr, nl, cat benchmarks that were already set up.

Comment thread src/uu/ptx/benches/ptx_bench.rs Outdated
Comment thread src/uu/ptx/benches/ptx_bench.rs Outdated
@oech3

oech3 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Can we use file for benchmark and use std instead of rustix?

@Aisha630

Copy link
Copy Markdown
Contributor Author

Can we use file for benchmark and use std instead of rustix?

Done. Removed the extra dependencies as well. I did the redirection earlier because running the benchmark locally was flooding the terminal. But I suppose that's a non-issue.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/tail/retry (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/follow-name (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cat/splice is no longer failing!
Congrats! The gnu test tests/ls/stat-free-symlinks is no longer failing!
Congrats! The gnu test tests/mv/dir2dir is no longer failing!
Congrats! The gnu test tests/nl/multibyte is no longer failing!
Note: The gnu test tests/cut/bounded-memory is now being skipped but was previously passing.
Congrats! The gnu test tests/rm/many-dir-entries-vs-OOM is now passing!

@Aisha630
Aisha630 requested a review from sylvestre July 22, 2026 22:42
@Aisha630

Copy link
Copy Markdown
Contributor Author

@sylvestre Hi, when you have a chance, could you please take a look at this PR? Thank you! Happy to make any changes

@sylvestre
sylvestre merged commit 9666485 into uutils:main Aug 13, 2026
123 of 125 checks passed
@cakebaker cakebaker mentioned this pull request Aug 13, 2026
@codspeed-hq

codspeed-hq Bot commented Aug 13, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 8.1%

⚠️ 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

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 345 untouched benchmarks
🆕 10 new benchmarks
⏩ 46 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation df_with_path 573.7 µs 704.6 µs -18.58%
Simulation complex_relative_date 330.2 µs 318.3 µs +3.74%
🆕 Memory ptx_input_references_short_lines[100000] N/A 222.2 MB N/A
🆕 Memory ptx_long_lines[100] N/A 29.5 MB N/A
🆕 Memory ptx_short_lines[100000] N/A 240.1 MB N/A
🆕 Memory ptx_input_references_long_lines[1000] N/A 29.1 MB N/A
🆕 Memory ptx_tex[10000] N/A 20.6 MB N/A
🆕 Simulation ptx_input_references_short_lines[100000] N/A 16 s N/A
🆕 Simulation ptx_long_lines[100] N/A 1.7 s N/A
🆕 Simulation ptx_short_lines[100000] N/A 14 s N/A
🆕 Simulation ptx_input_references_long_lines[1000] N/A 2 s N/A
🆕 Simulation ptx_tex[10000] N/A 2.9 s N/A

Tip

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


Comparing Aisha630:ptx-add-benchmark (2ba6147) with main (822aa83)

Open in CodSpeed

Footnotes

  1. 46 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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.

3 participants