Speed up benchmark cpu tests with _BORG_BENCHMARK_CPU_TEST env var#9417
Open
toroleapinc wants to merge 1 commit intoborgbackup:masterfrom
Open
Speed up benchmark cpu tests with _BORG_BENCHMARK_CPU_TEST env var#9417toroleapinc wants to merge 1 commit intoborgbackup:masterfrom
toroleapinc wants to merge 1 commit intoborgbackup:masterfrom
Conversation
Add _BORG_BENCHMARK_CPU_TEST environment variable (following the existing pattern of _BORG_BENCHMARK_CRUD_TEST) that reduces: - timeit iterations from 100 to 1 (10 to 1 for compression) - KDF iterations from 5 to 1 - random data buffer from 10MB to 100KB Set this env var in test_benchmark_cpu and test_benchmark_cpu_json so they complete quickly in CI while still exercising the full code path. Fixes borgbackup#9414 Signed-off-by: edvatar <88481784+toroleapinc@users.noreply.github.com>
ThomasWaldmann
requested changes
Feb 27, 2026
Member
ThomasWaldmann
left a comment
There was a problem hiding this comment.
Thanks for the PR, looks good, just one minor consistency fix please.
| else: | ||
| result["kdf"] = [] | ||
| count = 5 | ||
| count = 1 if is_test else 5 |
Member
There was a problem hiding this comment.
rename to number_kdf and move the line close to the others.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9417 +/- ##
=======================================
Coverage 76.47% 76.48%
=======================================
Files 85 85
Lines 14803 14807 +4
Branches 2213 2213
=======================================
+ Hits 11321 11325 +4
Misses 2803 2803
Partials 679 679 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test_benchmark_cpuandtest_benchmark_cpu_jsonare slow because they run the fullborg benchmark cpucommand with production-grade iteration counts (100 iterations of timeit for most operations, 5 for KDFs, 10MB random data buffer).Changes
Following the existing pattern of
_BORG_BENCHMARK_CRUD_TEST, this PR adds a_BORG_BENCHMARK_CPU_TESTenvironment variable that reduces:The tests now set this env var via
monkeypatch.setenv, making them complete quickly in CI while still exercising the full benchmark code path (all algorithms, all output formats).Fixes #9414