Port benchmark to python#255
Open
tameware wants to merge 10 commits into
Open
Conversation
Replace the shell implementation with python/tests/benchmark.py, keep ./benchmark.sh as a thin wrapper, and move the dirty-tree git-prep checks into //python:benchmark_test. Co-authored-by: Cursor <cursoragent@cursor.com>
…e/dds into port-benchmark-to-python
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ports the repository’s dtest benchmarking workflow from a large Bash script to a Python implementation, and updates Bazel targets accordingly (including replacing the prior shell-based git-prep test with a Python unit test suite).
Changes:
- Added a Python benchmark runner (
python/tests/benchmark.py) that supports building/checking out branches, runningdtest, and producing summary tables. - Added stdlib
unittestcoverage for argument parsing, output parsing, summary formatting, and git branch “dirty tree” gating (python/tests/benchmark_test.py). - Updated Bazel setup to expose the benchmark as a
py_binary/py_testand removed the previousrules_shelldependency andsh_test.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/tests/benchmark.py | New Python benchmark implementation for running and comparing dtest binaries. |
| python/tests/benchmark_test.py | New unit tests covering benchmark logic and git-prep behavior. |
| python/BUILD.bazel | Adds benchmark_lib, benchmark binary, and benchmark_test Bazel targets. |
| MODULE.bazel | Removes direct rules_shell dependency no longer needed after migrating tests. |
| BUILD.bazel | Removes the old sh_test target for benchmark git-prep validation. |
| benchmark.sh | Converts to a thin wrapper invoking the Python benchmark. |
| benchmark_git_prep_test.sh | Removes the old shell-based git-prep test script. |
tameware
marked this pull request as ready for review
July 22, 2026 03:09
Collaborator
Author
|
I'll address Copilot's open suggestions in a future PR. This one is intended to be a strict port, though in a moment of weakness I did add one divide-by-zero guard. |
Branch builds overwrite bazel-bin dtest, so that mix could benchmark the wrong executable after restore. Co-authored-by: Cursor <cursoragent@cursor.com>
Cleanup and main were hardcoding sys.stdout, so a redirected or custom output stream could miss the terminal teardown. Co-authored-by: Cursor <cursoragent@cursor.com>
run_build was hardcoding sys.stderr, which broke the runner constructor contract for redirected or custom error output. Co-authored-by: Cursor <cursoragent@cursor.com>
Dropping the whole solver/file row hid partial results; keep the line and omit ratio/note until both sides are available. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Bazel emits dtest.exe on nt, so the hardcoded dtest path broke the default baseline and checkout-binary overlap check on Windows. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
python/tests/benchmark.py:719
- detect_git_branch() calls out to
gitunconditionally via_git(...). If git is not installed (or not on PATH), this raisesFileNotFoundErrorand crashes even when the user is not using--branch(previous benchmark.sh tolerated missing git and just printed git branch as "unknown"). CatchOSErrorhere and fall back to "unknown".
def detect_git_branch(self) -> None:
probe = _git(self.root, "rev-parse", "--is-inside-work-tree", check=False)
if probe.returncode != 0:
self.git_branch = "unknown"
return
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
zzcgumn
approved these changes
Jul 23, 2026
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.
No description provided.