Skip to content

unexpand: Refactor functions to use less parameters#10900

Open
cerdelen wants to merge 1 commit intouutils:mainfrom
cerdelen:unexpand_refactor
Open

unexpand: Refactor functions to use less parameters#10900
cerdelen wants to merge 1 commit intouutils:mainfrom
cerdelen:unexpand_refactor

Conversation

@cerdelen
Copy link
Contributor

Follow up to #10831 (comment) i bundled parameters that belong to each other into a helper struct to reduce function parameters and get rid of the linter exception.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 12, 2026

Merging this PR will degrade performance by 6.7%

❌ 2 regressed benchmarks
✅ 282 untouched benchmarks
⏩ 38 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation unexpand_many_lines[100000] 189.7 ms 203.4 ms -6.7%
Simulation unexpand_large_file[10] 397.7 ms 426.3 ms -6.7%

Comparing cerdelen:unexpand_refactor (362c08d) with main (dec633c)

Open in CodSpeed

Footnotes

  1. 38 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.

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/pr/bounded-memory. tests/pr/bounded-memory is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/factor/t10 is no longer failing!
Congrats! The gnu test tests/factor/t34 is no longer failing!
Note: The gnu test tests/cut/bounded-memory is now being skipped but was previously passing.
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.
Congrats! The gnu test tests/printf/printf-surprise is now passing!

@oech3
Copy link
Contributor

oech3 commented Feb 13, 2026

Is this performance regression caused by codegen-units=1 by over killed inline extraction too?

@cerdelen
Copy link
Contributor Author

cerdelen commented Feb 13, 2026

@oech3 Im not sure where the performance regression for this bot comes from.

If i build unexpand in release mode on my local machine and test it with a 200k lines long file with natural text (its all of shakespeare works) for me it actually has an average improvement.

❯ hyperfine --warmup 10 --min-runs 1000 --max-runs 10000 "./unexpand_refactored shakespeare.txt" "./unexpand_orig shakespeare.txt"
Benchmark 1: ./unexpand_refactored shakespeare.txt
  Time (mean ± σ):       6.6 ms ±   0.2 ms    [User: 5.4 ms, System: 1.0 ms]
  Range (min … max):     6.3 ms …   9.7 ms    1000 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Benchmark 2: ./unexpand_orig shakespeare.txt
  Time (mean ± σ):       6.8 ms ±   0.7 ms    [User: 5.6 ms, System: 1.0 ms]
  Range (min … max):     6.5 ms …  24.7 ms    1000 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Summary
  ./unexpand_refactored shakespeare.txt ran
    1.03 ± 0.11 times faster than ./unexpand_orig shakespeare.txt

(edit: replacing screenshot with text)

@sylvestre
Copy link
Contributor

@cerdelen please replace your screenshot by text. screenshots are terrible for accessibility and search. thanks

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