Skip to content

perf(io): read directly into JavaScript file buffers - #2200

Merged
nicolas-abril merged 3 commits into
bendlang:mainfrom
toprameen:read-js-files-into-existing-buffer
Nov 18, 2026
Merged

nicolas-abril merged 3 commits into
bendlang:mainfrom
toprameen:read-js-files-into-existing-buffer

Conversation

@toprameen

Copy link
Copy Markdown
Contributor

JavaScript file reads allocated a temporary view and a one-element array for each host call. Positive reads now fill the existing buffer directly. Zero-byte reads still use readvSync so Bun reports OS errors such as EBADF on a write-only handle.

For 40,000 50-byte lines on macOS ARM64, the median of seven paired runs went from 979 to 770 ms on Bun and from 1,089 to 1,022 ms on Node. A single 16 MiB read and EOF check stayed within 1 ms of baseline. Repeated zero-byte Bun reads were slower in some stress runs.

The prompt fixture observes the direct read and still fails if the scheduler flush is removed. Local macOS and Linux ARM64 file fixtures preserve baseline results, and the repository gate passes 56/56. The mini-cluster gates did not run.

@toprameen
toprameen marked this pull request as ready for review November 17, 2026 19:16
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nicolas-abril
nicolas-abril merged commit e41e014 into bendlang:main Nov 18, 2026
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.

2 participants