perf: cache CST traversals, add __slots__, use tuple keys#1881
perf: cache CST traversals, add __slots__, use tuple keys#1881
Conversation
- Split collect_top_level_defs_with_usages into collect/mark phases to avoid redundant CST traversals when processing multiple name sets - Extract gather_source_imports so source module is traversed once per file instead of 3x (RW, RO, TESTGEN) - Add slots=True to InvocationId and FunctionTestInvocation dataclasses - Replace string concat keys with tuples in merge_test_results Benchmarks: extract_code_context ~1.39x faster, merge_test_results ~1.43x faster
|
Claude finished @KRRT7's task in 4m 0s —— View job PR Review SummaryChecklist
Prek Checks
Mypy has 60 errors across these files, but all are pre-existing in the codebase, not introduced by this PR. The PR itself adds no new type errors. Code Review🚩 Accidental version file changes
|
Summary
unused_definition_remover(split collect/mark phases) andcode_extractor(pre-computegather_source_importsonce per file instead of 3x)slots=TruetoInvocationIdandFunctionTestInvocationfrozen dataclassesmerge_test_resultsBenchmarks
extract_code_contextmerge_test_resultsTest plan
tests/test_code_context_extractor.py— 104 passedruff check+ruff formatclean