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/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 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 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/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. 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" 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"