perf: convert remaining node.children array accesses to childCount/child(i) - #562
Merged
askpt merged 1 commit intoAug 22, 2026
Conversation
…ild(i) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #562 +/- ##
=======================================
Coverage 97.90% 97.90%
=======================================
Files 10 10
Lines 3765 3766 +1
Branches 455 455
=======================================
+ Hits 3686 3687 +1
Misses 79 79 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The five mechanical conversions preserve traversal semantics and follow existing analyzer patterns.
Pull request overview
Optimizes Tree-sitter AST traversal by avoiding unnecessary children array materialization.
Changes:
- Replaces array iteration with
childCount/child(i). - Uses indexed access to retrieve the final C# child node.
File summaries
| File | Description |
|---|---|
rustAnalyzer.ts |
Optimizes nested-function traversal. |
pythonAnalyzer.ts |
Optimizes function-body traversal. |
jsLikeAnalyzer.ts |
Optimizes nested-function child analysis. |
goAnalyzer.ts |
Optimizes receiver parameter lookup. |
csharpAnalyzer.ts |
Avoids allocating an array for final-child access. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
askpt
approved these changes
Aug 22, 2026
askpt
deleted the
repo-assist/perf-remaining-children-array-20260822-2800eb077051cd8c
branch
August 22, 2026 14:42
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.
🤖 This is an automated PR from Repo Assist.
AI Disclosure
This change was generated autonomously by Repo Assist based on a codebase scan for remaining performance opportunities.
Rationale
A previous perf pass (merged) converted
node.childrenarray-getter accesses to thechildCount/child(i)pattern across the hot AST traversal loops in goAnalyzer, javaAnalyzer, jsLikeAnalyzer, pythonAnalyzer, and rustAnalyzer, since.childrenmaterializes a full array on every access. Five call sites were missed in that pass:pythonAnalyzer.tsandrustAnalyzer.ts: the nested-function body traversal loop in the mainvisit()entry point — hit once per function/method found in every analyzed file (hot path).jsLikeAnalyzer.ts: the nested-function grandchild traversal inanalyzeNode— hit for every nested function/closure.goAnalyzer.ts:findTypeInParameterList— lower frequency (once per method receiver lookup).csharpAnalyzer.ts:node.children[node.children.length - 1]in the preprocessor-fragmented-method fallback — allocated the whole array just to read the last element; replaced withnode.child(node.childCount - 1).This PR converts all five to the already-established
childCount/child(i)pattern used everywhere else in these files, avoiding the unnecessary array allocation.Trade-offs
None — purely mechanical, semantically identical iteration order, matches the existing sibling loops in the same functions.
Test Status
npm run compile: cleannpm run lint: cleannpm run test:unit: 227 passing, no coverage regression (98.69% stmts / 94.47% branch, same as baseline)vscode-test(full integration suite) not run — blocked by sandbox network restrictions as in all prior Repo Assist runsWarning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
releaseassets.githubusercontent.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.
Add this agentic workflow to your repo
To install this agentic workflow, run