|
1 | 1 | require_relative '../../harness/loader' |
2 | 2 | require_relative "lib/optcarrot" |
3 | 3 |
|
4 | | -rom_path = File.join(__dir__, "examples/Lan_Master.nes") |
5 | | -nes = Optcarrot::NES.new(["--headless", rom_path]) |
6 | | -nes.reset |
| 4 | +if ENV["YJIT_BENCH_RACTOR_HARNESS"] |
| 5 | + # Based on bin/optcarrot-bench-parallel-on-ractor |
| 6 | + [ |
| 7 | + Optcarrot::Config::DEFAULT_OPTIONS, |
| 8 | + Optcarrot::Config::OPTIONS, |
| 9 | + Optcarrot::Driver::DRIVER_DB, |
| 10 | + Optcarrot::Audio::PACK_FORMAT, |
| 11 | + Optcarrot::APU::Pulse::WAVE_FORM, |
| 12 | + Optcarrot::APU::Triangle::WAVE_FORM, |
| 13 | + Optcarrot::APU::FRAME_CLOCKS, |
| 14 | + Optcarrot::APU::OSCILLATOR_CLOCKS, |
| 15 | + Optcarrot::APU::LengthCounter::LUT, |
| 16 | + Optcarrot::APU::Noise::LUT, |
| 17 | + Optcarrot::APU::Noise::NEXT_BITS_1, |
| 18 | + Optcarrot::APU::Noise::NEXT_BITS_6, |
| 19 | + Optcarrot::APU::DMC::LUT, |
| 20 | + Optcarrot::PPU::DUMMY_FRAME, |
| 21 | + Optcarrot::PPU::BOOT_FRAME, |
| 22 | + Optcarrot::PPU::SP_PIXEL_POSITIONS, |
| 23 | + Optcarrot::PPU::TILE_LUT, |
| 24 | + Optcarrot::PPU::NMT_TABLE, |
| 25 | + Optcarrot::CPU::DISPATCH, |
| 26 | + Optcarrot::ROM::MAPPER_DB, |
| 27 | + ].each { |const| Ractor.make_shareable(const) } |
7 | 28 |
|
8 | | -run_benchmark(10) do |
9 | | - 200.times { nes.step } |
| 29 | + ROM_PATH = File.join(__dir__, "examples/Lan_Master.nes").freeze |
| 30 | + ENV["WARMUP_ITRS"] = "1" |
| 31 | + |
| 32 | + run_benchmark(10) do |
| 33 | + nes = Optcarrot::NES.new(["-b", "--no-print-video-checksum", ROM_PATH]) |
| 34 | + nes.reset |
| 35 | + |
| 36 | + 200.times { nes.step } |
| 37 | + end |
| 38 | +else |
| 39 | + rom_path = File.join(__dir__, "examples/Lan_Master.nes") |
| 40 | + nes = Optcarrot::NES.new(["--headless", rom_path]) |
| 41 | + nes.reset |
| 42 | + |
| 43 | + run_benchmark(10) do |
| 44 | + 200.times { nes.step } |
| 45 | + end |
10 | 46 | end |
0 commit comments