perf: prefilter files by path before read_text() in discovery#2134
Open
perf: prefilter files by path before read_text() in discovery#2134
Conversation
This was referenced May 7, 2026
5c1cc1e to
828496b
Compare
20d0cd6 to
07e5828
Compare
828496b to
36074a3
Compare
07e5828 to
593a5a7
Compare
36074a3 to
6bbf072
Compare
Moves path-based checks (test file detection, ignore paths, submodule paths, site-packages, outside module-root) to run BEFORE read_text() is called in get_all_files_and_functions() and get_functions_within_lines(). This avoids unnecessary file I/O for files that would be discarded by filter_functions() anyway. Also fixes pre-existing mypy error in _find_all_functions_via_language_support where discover_functions was called with wrong argument order. Signature changes (backward-compatible, all new params are optional): - get_all_files_and_functions: added tests_root, module_root params - get_functions_within_lines: added tests_root, ignore_paths, module_root - get_functions_within_git_diff: added tests_root, ignore_paths, module_root
593a5a7 to
4bf0aaf
Compare
Base automatically changed from
fix/mypy-strict-errors
to
fix/subprocess-xml-errors
May 7, 2026 22:47
6bbf072 to
6527780
Compare
Base automatically changed from
fix/subprocess-xml-errors
to
fix/test-files-silent-dedup
May 8, 2026 00:15
aseembits93
previously approved these changes
May 8, 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.
Parent PR
#2132 — perf: targeted performance improvements for E2E pipeline hot path
Summary
read_text()during function discoveryfilter_functions()are now skipped before any I/Ofilter_functions()still runs afterward as a safety net for callers that don't pass prefilter params (e.g. LSP)Changes
get_all_files_and_functions(): added optionaltests_root,module_rootparams to enable prefilteringget_functions_within_lines()/get_functions_within_git_diff(): same optional paramstests/test_discovery_prefilter.py(7 tests)Stack
fix/mypy-strict-errors