Skip to content

perf(worker): avoid quadratic fd tracking - #188

Merged
steipete merged 2 commits into
mainfrom
claude/worker-fd-tracking-performance
Oct 17, 2026
Merged

steipete merged 2 commits into
mainfrom
claude/worker-fd-tracking-performance

Conversation

@steipete

Copy link
Copy Markdown

#184 tracks Worker-owned file descriptors in a Vec, with linear contains and position scans. A synchronous 2,000-fd open/close loop in a Worker was 18.74% slower than before #184; the bootstrap 95% CI for the paired difference excludes zero.

Replace the vector with hash-set tracking, preserving insert/remove semantics. Exit-time close order is irrelevant, and Node's trackUnmanagedFds also uses an unordered set.

The loop is 19.7% faster than 785be5fef and 1.95% above the pre-#184 baseline. The remaining ~0.18 ms nested-exit cost is the intended work of closing descriptors that pre-#184 leaked.

Validation: all 15 ownership tests in test/js/node/worker_threads/worker-track-unmanaged-fds.test.ts pass. bench/worker-fd-tracking.mjs provides the regression benchmark; formatting and whitespace checks pass.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T02:24:40.752334Z 177ab21 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete merged commit b76e4b4 into main Oct 17, 2026
10 checks passed
@steipete
steipete deleted the claude/worker-fd-tracking-performance branch October 17, 2026 02:38
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