Skip to content

[trees] Focus/Nav + Visible tree projection feature + performance optimizations#490

Merged
SlexAxton merged 2 commits into
mainfrom
autoresearch/path-store-toggle-collapse-perf/01-visible-tree-projection
Apr 8, 2026
Merged

[trees] Focus/Nav + Visible tree projection feature + performance optimizations#490
SlexAxton merged 2 commits into
mainfrom
autoresearch/path-store-toggle-collapse-perf/01-visible-tree-projection

Conversation

@SlexAxton

Copy link
Copy Markdown
Contributor

Add phase 3 work, focus, navigation, etc.

Fix perf in collapse situations.

Meaningfully improve a11y around virtualizer for focus states i think.

Add createVisibleTreeProjection API with benchmark/profile scripts, public types, static-store integration, test coverage, and tree controller/view integration.

Includes major performance optimizations:

  • Rewrite createVisibleTreeProjection: single-pass with Int32Array parent/child tracking, lazy visibleIndexByPath Map
  • Add DFS-based full-tree getVisibleSlice (avoids parent-walk for sibling finding)
  • Inline file-node materialization in DFS (~70% of rows skip directory checks)
  • Inline path cache + segment lookup in hot loop
  • Cache DirectoryChildIndex in DFS stack frame (avoid per-child Map.get)
  • Collapse benchmark uses preparePresortedInput to skip re-sorting
  • Eager name-id map building in presorted builder finish
  • Iterative recomputeCountsRecursive (explicit stack, -64% sub-timing)

Experiments: #1#12, #15, #20, #21
toggle_wall_ms: 877ms → 143ms (-84%)
collapse_wall_ms: 4757ms → 1510ms (-68%)

Add createVisibleTreeProjection API with benchmark/profile scripts, public types, static-store integration, test coverage, and tree controller/view integration.

Includes major performance optimizations:
- Rewrite createVisibleTreeProjection: single-pass with Int32Array parent/child tracking, lazy visibleIndexByPath Map
- Add DFS-based full-tree getVisibleSlice (avoids parent-walk for sibling finding)
- Inline file-node materialization in DFS (~70% of rows skip directory checks)
- Inline path cache + segment lookup in hot loop
- Cache DirectoryChildIndex in DFS stack frame (avoid per-child Map.get)
- Collapse benchmark uses preparePresortedInput to skip re-sorting
- Eager name-id map building in presorted builder finish
- Iterative recomputeCountsRecursive (explicit stack, -64% sub-timing)

Experiments: #1#12, #15, #20, #21
toggle_wall_ms: 877ms → 143ms (-84%)
collapse_wall_ms: 4757ms → 1510ms (-68%)
@vercel

vercel Bot commented Apr 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierrejs-diff-demo Ready Ready Preview Apr 8, 2026 5:09am
pierrejs-docs Ready Ready Preview Apr 8, 2026 5:09am

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91ed9f234d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// lastRowAtDepth[d+1] stores the projection-row index of the most recent row
// at depth d. Index 0 is the virtual root. Offset by +1 so depth 0 maps to
// lastRowAtDepth[1] and the virtual root is at lastRowAtDepth[0] = -1.
const lastRowAtDepth = new Int32Array(64);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle arbitrary row depths in projection builder

The fixed Int32Array(64) depth table silently breaks projection metadata for trees deeper than 63 levels. Once row.depth >= 64, lastRowAtDepth[depth] returns undefined, so countSlot becomes NaN, posInSet becomes NaN, and parent linkage/set sizes are corrupted (e.g., parentPath falls back to null). In this commit that bad metadata now drives keyboard parent navigation and ARIA set math, so deeply nested repos will get incorrect focus behavior and invalid tree semantics.

Useful? React with 👍 / 👎.

@SlexAxton
SlexAxton merged commit ff7b624 into main Apr 8, 2026
10 checks passed
@SlexAxton
SlexAxton deleted the autoresearch/path-store-toggle-collapse-perf/01-visible-tree-projection branch April 8, 2026 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant