The Computer Language
24.11 Benchmarks Game

too simple Ruby yjit program

source code

# The Computer Language Benchmarks Game
# https://salsa.debian.org/benchmarksgame-team/benchmarksgame/

# mtime side-effect
open("./one", "w").close()

n = ARGV[0].to_i
sum = 0.0
flip = -1.0
for i in 1..n do
    flip *= -1.0        
    sum += flip / (2*i - 1) 
end
puts "%0.9f" % (sum*4.0)

# mtime side-effect
open("./two", "w").close()
    

notes, command-line, and program output

NOTES:
64-bit Ubuntu quad core
ruby 3.3.5
(2024-09-03
revision ef084cc8f4)
+YJIT [x86_64-linux]


 Sun, 22 Sep 2024 00:56:51 GMT

COMMAND LINE:
 /opt/src/ruby-3.3.5/bin/ruby --yjit -W0 toosimple.ruby 10000000000

PROGRAM OUTPUT:
3.141592653