Skip to content

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

Merged
hsbt merged 3 commits into
mainfrom
claude/elegant-neumann-d38e2c
Oct 8, 2026
Merged

hsbt merged 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
  • Run ruby bin/rails in railsbench instead of relying on the shebang

Where Process.fork is unavailable, knucleotide measures something different from Linux, so it 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 2 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>
@hsbt
hsbt force-pushed the claude/elegant-neumann-d38e2c branch 4 times, most recently from 4fe1373 to 817cf58 Compare October 7, 2026 11:55
Windows has no fork and cannot run bin/rails by its shebang. knucleotide computes its workers sequentially there, so it is not comparable with Linux. gvl_release_acquire now opens File::NULL instead of /dev/null, but it still reads /dev/zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hsbt
hsbt force-pushed the claude/elegant-neumann-d38e2c branch from 817cf58 to 435701a Compare October 7, 2026 22:54
@hsbt
hsbt merged commit b5e2147 into main Oct 8, 2026
11 checks passed
@hsbt
hsbt deleted the claude/elegant-neumann-d38e2c branch October 8, 2026 00:05
Comment thread lib/benchmark_suite.rb
*pre_init,
script_path,
].compact
].compact).map(&:to_s)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

map(&:to_s)

Which element was not string?

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