= 40_000_000) n.times.count do a = a * 16807 % 2147483647 b = b * 48271 % 2147483647 (a & 0xffff) == (b & 0xffff) end end raise unless calculate(65, 8921) == 588 p result: calculate(699, 124)
user 0.12s system 97% cpu 11.084 total $ ruby --disable-gems --jit tmp/bench.rb {:result=>600} ruby --disable-gems --jit tmp/playing.rb 8.12s user 0.13s system 103% cpu 7.973 total 3VCZͷ+*5Λࢼͯ͠ΈΔ +*5ͰTTվળʂʂ
. . ruby --jit --jit-verbose=2 tmp/bench.rb 12.67s user 0.73s system 148% cpu 9.055 total 3VCZͷ+*5Λࢼͯ͠ΈΔ ͪͳΈʹAEJTBCMFHFNTAΦϓγϣϯΛ֎͢ ͱɻɻɻʁ ෆཁͳDPNQJMF͕ͬͯΉ͠Ζ͘ͳΔ