Context
Deferred from PR #446 (fix/agent-reported-batch) code review:
- Review dir:
.devflow/docs/reviews/fix-agent-reported-batch/2026-07-13_1130
- Review date: 2026-07-15
- Consolidates: ISSUE-13, ISSUE-18
- Reason: Premature-optimization perf note; bounded + within <50ms/1000-line target; reviewer flags MEASURE-BEFORE-OPTIMIZING
Issue
Upward parent-walk overhead in is_return_field_child
- File:
crates/rskim-core/src/transform/pseudo.rs:556
- Problem:
is_return_field_child walks node.parent() (O(subtree-depth) in tree-sitter C bindings) once per strippable Python/TS type node
- Current state: Bounded by MAX_AST_DEPTH/MAX_AST_NODES and comfortably within the <50ms/1000-line target; no demonstrated performance impact
Solution
MEASURE FIRST (this is not a blocker):
- Create a type-annotation-heavy TS/Python benchmark fixture (e.g., 100+ param/return type annotations)
- Profile
skim <fixture> --mode=pseudo with flame graph or perf
- Measure: overhead of
is_return_field_child parent-walk vs total transform time
- If measured overhead > 5% of transform time: Optimize by threading TreeCursor
field_name() into the collect_noise_ranges recursion to check field_name == "return_type" in O(1)
- If measured overhead < 5%: Close as WONTFIX — the parent-walk is negligible and the simpler logic is safer
Implementation Notes
- Do NOT optimize without measurement — follow "measure before optimizing" discipline
- Regression target: must stay under <50ms/1000-line SLA
- Benchmarking task may belong in
rskim-bench or as a standalone script
Related
Context
Deferred from PR #446 (fix/agent-reported-batch) code review:
.devflow/docs/reviews/fix-agent-reported-batch/2026-07-13_1130Issue
Upward parent-walk overhead in
is_return_field_childcrates/rskim-core/src/transform/pseudo.rs:556is_return_field_childwalksnode.parent()(O(subtree-depth) in tree-sitter C bindings) once per strippable Python/TS type nodeSolution
MEASURE FIRST (this is not a blocker):
skim <fixture> --mode=pseudowith flame graph orperfis_return_field_childparent-walk vs total transform timefield_name()into thecollect_noise_rangesrecursion to checkfield_name == "return_type"in O(1)Implementation Notes
rskim-benchor as a standalone scriptRelated