perf(tools): collapse blank-line runs before matching stub wrappers in the progress scan #14321
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14321"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T09:11:42Z.
What
tools/progress.pycode()blanks comments to whitespace. A file with many comment-only lines therefore becomes a long run of blank lines.STUB_WRAPPERallows whitespace inside its return-type class, so the regex re-scanned that run from every line start. On the full tree, the twoSTUB_WRAPPERpasses account for most of the scan time.code()now collapses blank-line runs after the blanking. No line number is computed from the blanked text, so the matched names do not change. The output is byte-identical to the previous code (see Tested).Commits:
10e5486a27: the collapse incode().8710666a62: two tests intools/tests/test_progress_wrappers.py.Tested
Linux, Python 3.11.2, on
upstream/main5c9837bfe7plus these commits.python3 tools/tests/test_progress_wrappers.py: 13 tests, OK.test_progress.py: 57 tests, OK.test_progress_encoding.py: 6, OK.test_progress_render_sliver.py: 2, OK.test_progress_read_encoding.py: 3, OK.test_progress_report_inputs.py: 2, OK.WrapperTests.test_comment_only_lines_leave_no_blank_line_runsrun againstupstream/main'stools/progress.pyfails, because the blanked text still contains a blank-line run.WrapperTests.test_multi_line_return_type_helper_is_pendingpasses on both, and guards theSTUB_WRAPPERclass against a naive removal of newlines.python3 tools/progress.py <output>with the base tool and with this branch's tool, over the same source checkout.progress.json,progress.htmlandprogress.svgare byte-identical. Wall time on this host, one run each: base 41.5 s, this branch 20.1 s. Other jobs were running on the host during both runs, so treat the times as indicative.python3 tools/check_conventions.py --base upstream/mainandgit diff --check upstream/main: clean.tools/tests/test_progress_wrappers.py: 9 findings, alltest-without-assertion. They are on tests that assert through the file's existingassertTodohelper, which the heuristic cannot see, as the existing tests already do. The new comment test uses a plainassertEqual.Not run: the Pages and progress-report workflows on GitHub.
Checklist
mainNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T06:22:29Z.
Review: COMMENTED
Reviewed — no blocking findings
progress.code()now collapses runs of blank lines after the comment and string blanking, so the stub-wrapper scan works on fewer characters. The result is only whitespace, and the scan's output is names and percentages, not line numbers. The hosted ubuntu CTest run passedprogress_wrappers, which runs the new tests.What I ran
8710666a629e51e8dde7572ec825acdc649097b6; base26fa1212b82f76dd49cf12d65e445d6ff3e0844c. 2 files:tools/progress.py(one line changed incode()) andtools/tests/test_progress_wrappers.py(+11: two new tests and animport re).code()is used:scan_library(line 167) reads the result for pattern matching. The result is used for matching and counting, not for line numbers.reis imported (line 5).progress_wrappers(Test #29, passed, 0.13 s)..pyfiles.Results
code()output is used for matching, not line numbersscan_library, line 167reis importedstatementsandinert_bodystrip each part and skip empty ones; theSTUB_WRAPPERheader regex was not readprogress_wrappers(hosted, ubuntu CTest)Test #29, 0.13 sRead-only check output
Precheck was not run: no PR-head code is run here, and the PR changes
.pyfiles. Diff check: passed. Conventions: passed. ABI audit: not applicable. Stack check: passed. Hosted:gh api repos/boykopovar/AnyPS5/commits/8710666a629e51e8dde7572ec825acdc649097b6/check-runs, and the ubuntu relinker job log.Negative control
Not run here. A negative control needs a local run of the Python tests, and the PR's Python code is not run here.
Findings
Blocking
None.
Non-blocking
None.
Sources
github.com/boykopovar/AnyPS5@8710666a62/tools/progress.pygithub.com/boykopovar/AnyPS5@8710666a62/tools/tests/test_progress_wrappers.pygithub.com/boykopovar/AnyPS5@8710666a62/CMakeLists.txt(lines 238-239)Not verified
STUB_WRAPPERheader regex, against blank lines between a function's return type and its name.To get this to a good state