Skip to content

Replace hard-coded POSIX dependencies with portable code - #543

Open
hsbt wants to merge 3 commits into
mainfrom
claude/elegant-neumann-d38e2c
Open

hsbt wants to merge 3 commits into
mainfrom
claude/elegant-neumann-d38e2c

Conversation

@hsbt

@hsbt hsbt commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

YJIT now works on mswin, so I'd like to evaluate it with ruby-bench. I plan to open two PRs. This one mainly makes code that hard-codes POSIX behavior portable, and none of it is specific to Windows.

  • Join PATH entries with File::PATH_SEPARATOR instead of :
  • Redirect to File::NULL instead of /dev/null
  • Create output directories with FileUtils.mkdir_p instead of mkdir -p
  • Run benchmark commands from an argv array instead of a shelljoin-ed string, so Shellwords escapes such as \= never reach Ruby
  • Compute knucleotide workers sequentially where Process.fork is unavailable
  • Read zeros from a temporary file in gvl_release_acquire when /dev/zero is missing
  • Run ruby bin/rails in railsbench instead of relying on the shebang

Where these fallbacks apply, knucleotide and gvl_release_acquire measure something different from Linux, so they should be left out of comparisons with Linux. Comparing two builds on the same machine is unaffected.

After this is merged, I will open a PR with the mswin-specific changes.

Generated with Claude Code

hsbt and others added 3 commits October 7, 2026 20:52
cmd.exe has no /dev/null or mkdir -p, and PATH entries are separated with ";". With ":", a benchmarked Ruby that is not the first ruby on PATH never got its directory in front, and the first existing entry was broken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing on Windows removes the backslashes Shellwords adds, so an option such as --yjit-call-threshold=1 reached Ruby as --yjit-call-threshold\=1 and YJIT rejected it. The PATH override also used ":" as the separator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows has no fork, no /dev/null or /dev/zero, and no shebang execution of bin/rails. There knucleotide computes its workers sequentially and gvl_release_acquire reads a regular file, so neither is comparable with Linux.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hsbt
hsbt force-pushed the claude/elegant-neumann-d38e2c branch 4 times, most recently from 4fe1373 to 817cf58 Compare October 7, 2026 11:55
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