From a11451e8850a669a416b9d8286a807dae9ce390f Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 7 Oct 2026 17:11:03 +0900 Subject: [PATCH 1/5] Install sqlite3 on Windows too Bundler's :ruby platform excludes Windows, so activerecord, railsbench and sequel had no sqlite3 there. The lockfiles stay valid, which I checked with a frozen bundle install on Linux. Co-Authored-By: Claude Opus 5.5 --- benchmarks/activerecord/Gemfile | 2 +- benchmarks/railsbench/Gemfile | 2 +- benchmarks/sequel/Gemfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmarks/activerecord/Gemfile b/benchmarks/activerecord/Gemfile index ed3c30bc..b7e948bb 100644 --- a/benchmarks/activerecord/Gemfile +++ b/benchmarks/activerecord/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" gem "activerecord", "~> 8.0" -gem "sqlite3", platform: :ruby +gem "sqlite3", platforms: [:ruby, :windows] gem "activerecord-jdbc-adapter", github: "k0kubun/activerecord-jdbc-adapter", ref: "rails-8.1-sqlite3", platform: :jruby gem "activerecord-jdbcsqlite3-adapter", github: "k0kubun/activerecord-jdbc-adapter", ref: "rails-8.1-sqlite3", platform: :jruby gem "mutex_m" diff --git a/benchmarks/railsbench/Gemfile b/benchmarks/railsbench/Gemfile index 9e0756aa..3e104614 100644 --- a/benchmarks/railsbench/Gemfile +++ b/benchmarks/railsbench/Gemfile @@ -20,7 +20,7 @@ gem 'sprockets-rails', '3.2.2' gem 'stackprof', platforms: :mri # Use sqlite3 as the database for Active Record -gem 'sqlite3', platform: :ruby +gem 'sqlite3', platforms: [:ruby, :windows] gem 'activerecord-jdbc-adapter', github: 'k0kubun/activerecord-jdbc-adapter', ref: 'rails-8.1-sqlite3', platform: :jruby gem 'activerecord-jdbcsqlite3-adapter', github: 'k0kubun/activerecord-jdbc-adapter', ref: 'rails-8.1-sqlite3', platform: :jruby # Use webrick for the web server since it's easy to install. diff --git a/benchmarks/sequel/Gemfile b/benchmarks/sequel/Gemfile index f0a7806b..90838ed8 100644 --- a/benchmarks/sequel/Gemfile +++ b/benchmarks/sequel/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" gem "sequel", "~> 5.63" -gem "sqlite3", "~> 1.4", platform: :ruby +gem "sqlite3", "~> 1.4", platforms: [:ruby, :windows] gem "jdbc-sqlite3", "~> 3.32.3", platform: :jruby gem "bigdecimal" From e878a88eb7c902ba0548b83fdeb6fbaab300061d Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 7 Oct 2026 17:11:05 +0900 Subject: [PATCH 2/5] Bundle tzinfo-data for lobsters on Windows Same as railsbench. Without zoneinfo files, booting the app fails in TZInfo. Co-Authored-By: Claude Opus 5.5 --- benchmarks/lobsters/Gemfile | 3 +++ benchmarks/lobsters/Gemfile.lock | 1 + 2 files changed, 4 insertions(+) diff --git a/benchmarks/lobsters/Gemfile b/benchmarks/lobsters/Gemfile index 4ec6fe53..33eac9fa 100644 --- a/benchmarks/lobsters/Gemfile +++ b/benchmarks/lobsters/Gemfile @@ -11,6 +11,9 @@ gem "cgi" # Workaround cgi extraction in Ruby 3.5.0-dev gem rails_gem, "~> 8.0" end +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem "tzinfo-data", platforms: [:windows, :jruby] + gem "sqlite3" #gem "mysql2" diff --git a/benchmarks/lobsters/Gemfile.lock b/benchmarks/lobsters/Gemfile.lock index f9456dfc..10e798c2 100644 --- a/benchmarks/lobsters/Gemfile.lock +++ b/benchmarks/lobsters/Gemfile.lock @@ -372,6 +372,7 @@ DEPENDENCIES sqlite3 stackprof svg-graph + tzinfo-data vcr webmock From dce12fda7c318d87bb9a03fdac575319d2bb910e Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 8 Oct 2026 09:42:37 +0900 Subject: [PATCH 3/5] Open the rubyboy ROM in binary mode on Windows rubyboy reads its ROM with mode "r", so the CRLF conversion of Windows corrupts it and the emulator hits an unknown opcode. Co-Authored-By: Claude Opus 5.5 --- benchmarks/rubyboy/benchmark.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/benchmarks/rubyboy/benchmark.rb b/benchmarks/rubyboy/benchmark.rb index 54b0d5e1..5a086fc2 100644 --- a/benchmarks/rubyboy/benchmark.rb +++ b/benchmarks/rubyboy/benchmark.rb @@ -13,6 +13,16 @@ # The rom is included in the gem in a sibling directory to the rubyboy code. ROM_PATH = File.expand_path("../../roms/tobu.gb", $".detect { |x| x.end_with?("/rubyboy/emulator_headless.rb") }).freeze +# Rubyboy opens the ROM with mode "r", which converts CRLF to LF on Windows. +if Gem.win_platform? + File.singleton_class.prepend(Module.new do + def open(path, *args, **kwargs, &block) + args[0] = "rb" if path == ROM_PATH && args[0] == "r" + super(path, *args, **kwargs, &block) + end + end) +end + # A count of 500 produces results similar to our optcarrot benchmark. # It's possible there is a number that produces a consistent benchmark without # needing to re-initialize but not sure how to determine that. From 5b0ff24d556729ff6f01dfa056d0cebbe9296bf1 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 8 Oct 2026 09:42:38 +0900 Subject: [PATCH 4/5] Skip loading pty for shipit on Windows shipit-engine requires pty, which Windows lacks, at load time. Only deploy commands use it, and the benchmark never runs them. Co-Authored-By: Claude Opus 5.5 --- benchmarks/shipit/benchmark.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/benchmarks/shipit/benchmark.rb b/benchmarks/shipit/benchmark.rb index 54e51dfa..d7b2ce7d 100644 --- a/benchmarks/shipit/benchmark.rb +++ b/benchmarks/shipit/benchmark.rb @@ -11,6 +11,9 @@ require 'securerandom' ENV['SECRET_KEY_BASE'] = SecureRandom.hex(128) +# shipit-engine requires pty, which Windows lacks, only to run deploy commands that the benchmark never starts. +$LOADED_FEATURES << File.join(RbConfig::CONFIG["archdir"], "pty.so") if Gem.win_platform? + require_relative 'config/environment' require_relative "route_generator" From 1eb06e48694ee01a234a1e005b32dca745910f09 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 8 Oct 2026 07:59:25 +0900 Subject: [PATCH 5/5] Read zeros from a file in gvl_release_acquire on Windows Windows has no /dev/zero. The benchmark is about GVL handoffs rather than I/O, so a regular file of the same zeros is enough, and it is kept in the ignored data/ directory rather than left in a temporary directory. Co-Authored-By: Claude Opus 5.5 --- benchmarks/gvl_release_acquire/benchmark.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/benchmarks/gvl_release_acquire/benchmark.rb b/benchmarks/gvl_release_acquire/benchmark.rb index bf8ad256..e735bfe2 100644 --- a/benchmarks/gvl_release_acquire/benchmark.rb +++ b/benchmarks/gvl_release_acquire/benchmark.rb @@ -1,8 +1,20 @@ require_relative "../../harness/loader" +# Windows has no /dev/zero, so read the same zeros from a regular file kept in data/. +ZERO_PATH = if File.exist?("/dev/zero") + "/dev/zero" +else + File.join(__dir__, "data", "zero").tap do |path| + unless File.size?(path) == 1_000_000 + Dir.mkdir(File.dirname(path)) unless Dir.exist?(File.dirname(path)) + File.binwrite(path, "\0" * 1_000_000) + end + end +end.freeze + run_benchmark(5) do |num_rs, ractor_args| output = File.open(File::NULL, "wb") - input = File.open("/dev/zero", "rb") + input = File.open(ZERO_PATH, "rb") 100_000.times do output.write(input.read(10)) end