Created
September 12, 2016 04:53
-
-
Save nurse/70ddf2b4e82537d71f066d8609853dc4 to your computer and use it in GitHub Desktop.
Benchmark result on Haswell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2016-09-12 07:02:10 +0900 | |
target 0: ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] at "./miniruby55727 -I./lib -I. -I.ext/common --disable-gem" | |
target 1: built-ruby (ruby 2.4.0dev (2016-09-11) [x86_64-linux]) at "./miniruby -I./lib -I. -I.ext/common --disable-gem" | |
measure target: real | |
----------------------------------------------------------- | |
app_answer | |
def ack(m, n) | |
if m == 0 then | |
n + 1 | |
elsif n == 0 then | |
ack(m - 1, 1) | |
else | |
ack(m - 1, ack(m, n - 1)) | |
end | |
end | |
def the_answer_to_life_the_universe_and_everything | |
(ack(3,7).to_s.split(//).inject(0){|s,x| s+x.to_i}.to_s + "2" ).to_i | |
end | |
answer = the_answer_to_life_the_universe_and_everything | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.054968526936136186 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.043999257031828165 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.043813185999169946 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.06688361300621182 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.06308504904154688 | |
built-ruby 0.06399883492849767 | |
built-ruby 0.047931801062077284 | |
built-ruby 0.07002927793655545 | |
built-ruby 0.04975632997229695 | |
built-ruby 0.06824782805051655 | |
----------------------------------------------------------- | |
app_aobench | |
# AO render benchmark | |
# Original program (C) Syoyo Fujita in Javascript (and other languages) | |
# https://code.google.com/p/aobench/ | |
# Ruby(yarv2llvm) version by Hideki Miura | |
# | |
IMAGE_WIDTH = 256 | |
IMAGE_HEIGHT = 256 | |
NSUBSAMPLES = 2 | |
NAO_SAMPLES = 8 | |
class Vec | |
def initialize(x, y, z) | |
@x = x | |
@y = y | |
@z = z | |
end | |
attr_accessor :x, :y, :z | |
def vadd(b) | |
Vec.new(@x + b.x, @y + b.y, @z + b.z) | |
end | |
def vsub(b) | |
Vec.new(@x - b.x, @y - b.y, @z - b.z) | |
end | |
def vcross(b) | |
Vec.new(@y * b.z - @z * b.y, | |
@z * b.x - @x * b.z, | |
@x * b.y - @y * b.x) | |
end | |
def vdot(b) | |
@x * b.x + @y * b.y + @z * b.z | |
end | |
def vlength | |
Math.sqrt(@x * @x + @y * @y + @z * @z) | |
end | |
def vnormalize | |
len = vlength | |
v = Vec.new(@x, @y, @z) | |
if len > 1.0e-17 then | |
v.x = v.x / len | |
v.y = v.y / len | |
v.z = v.z / len | |
end | |
v | |
end | |
end | |
class Sphere | |
def initialize(center, radius) | |
@center = center | |
@radius = radius | |
end | |
attr_reader :center, :radius | |
def intersect(ray, isect) | |
rs = ray.org.vsub(@center) | |
b = rs.vdot(ray.dir) | |
c = rs.vdot(rs) - (@radius * @radius) | |
d = b * b - c | |
if d > 0.0 then | |
t = - b - Math.sqrt(d) | |
if t > 0.0 and t < isect.t then | |
isect.t = t | |
isect.hit = true | |
isect.pl = Vec.new(ray.org.x + ray.dir.x * t, | |
ray.org.y + ray.dir.y * t, | |
ray.org.z + ray.dir.z * t) | |
n = isect.pl.vsub(@center) | |
isect.n = n.vnormalize | |
else | |
0.0 | |
end | |
end | |
nil | |
end | |
end | |
class Plane | |
def initialize(p, n) | |
@p = p | |
@n = n | |
end | |
def intersect(ray, isect) | |
d = [email protected](@n) | |
v = ray.dir.vdot(@n) | |
v0 = v | |
if v < 0.0 then | |
v0 = -v | |
end | |
if v0 < 1.0e-17 then | |
return | |
end | |
t = -(ray.org.vdot(@n) + d) / v | |
if t > 0.0 and t < isect.t then | |
isect.hit = true | |
isect.t = t | |
isect.n = @n | |
isect.pl = Vec.new(ray.org.x + t * ray.dir.x, | |
ray.org.y + t * ray.dir.y, | |
ray.org.z + t * ray.dir.z) | |
end | |
nil | |
end | |
end | |
class Ray | |
def initialize(org, dir) | |
@org = org | |
@dir = dir | |
end | |
attr_accessor :org, :dir | |
end | |
class Isect | |
def initialize | |
@t = 10000000.0 | |
@hit = false | |
@pl = Vec.new(0.0, 0.0, 0.0) | |
@n = Vec.new(0.0, 0.0, 0.0) | |
end | |
attr_accessor :t, :hit, :pl, :n | |
end | |
def clamp(f) | |
i = f * 255.5 | |
if i > 255.0 then | |
i = 255.0 | |
end | |
if i < 0.0 then | |
i = 0.0 | |
end | |
i.to_i | |
end | |
def otherBasis(basis, n) | |
basis[2] = Vec.new(n.x, n.y, n.z) | |
basis[1] = Vec.new(0.0, 0.0, 0.0) | |
if n.x < 0.6 and n.x > -0.6 then | |
basis[1].x = 1.0 | |
elsif n.y < 0.6 and n.y > -0.6 then | |
basis[1].y = 1.0 | |
elsif n.z < 0.6 and n.z > -0.6 then | |
basis[1].z = 1.0 | |
else | |
basis[1].x = 1.0 | |
end | |
basis[0] = basis[1].vcross(basis[2]) | |
basis[0] = basis[0].vnormalize | |
basis[1] = basis[2].vcross(basis[0]) | |
basis[1] = basis[1].vnormalize | |
end | |
class Scene | |
def initialize | |
@spheres = Array.new | |
@spheres[0] = Sphere.new(Vec.new(-2.0, 0.0, -3.5), 0.5) | |
@spheres[1] = Sphere.new(Vec.new(-0.5, 0.0, -3.0), 0.5) | |
@spheres[2] = Sphere.new(Vec.new(1.0, 0.0, -2.2), 0.5) | |
@plane = Plane.new(Vec.new(0.0, -0.5, 0.0), Vec.new(0.0, 1.0, 0.0)) | |
end | |
def ambient_occlusion(isect) | |
basis = Array.new | |
otherBasis(basis, isect.n) | |
ntheta = NAO_SAMPLES | |
nphi = NAO_SAMPLES | |
eps = 0.0001 | |
occlusion = 0.0 | |
p0 = Vec.new(isect.pl.x + eps * isect.n.x, | |
isect.pl.y + eps * isect.n.y, | |
isect.pl.z + eps * isect.n.z) | |
nphi.times do |j| | |
ntheta.times do |i| | |
r = rand | |
phi = 2.0 * 3.14159265 * rand | |
x = Math.cos(phi) * Math.sqrt(1.0 - r) | |
y = Math.sin(phi) * Math.sqrt(1.0 - r) | |
z = Math.sqrt(r) | |
rx = x * basis[0].x + y * basis[1].x + z * basis[2].x | |
ry = x * basis[0].y + y * basis[1].y + z * basis[2].y | |
rz = x * basis[0].z + y * basis[1].z + z * basis[2].z | |
raydir = Vec.new(rx, ry, rz) | |
ray = Ray.new(p0, raydir) | |
occisect = Isect.new | |
@spheres[0].intersect(ray, occisect) | |
@spheres[1].intersect(ray, occisect) | |
@spheres[2].intersect(ray, occisect) | |
@plane.intersect(ray, occisect) | |
if occisect.hit then | |
occlusion = occlusion + 1.0 | |
else | |
0.0 | |
end | |
end | |
end | |
occlusion = (ntheta.to_f * nphi.to_f - occlusion) / (ntheta.to_f * nphi.to_f) | |
Vec.new(occlusion, occlusion, occlusion) | |
end | |
def render(w, h, nsubsamples) | |
cnt = 0 | |
nsf = nsubsamples.to_f | |
h.times do |y| | |
w.times do |x| | |
rad = Vec.new(0.0, 0.0, 0.0) | |
# Subsampling | |
nsubsamples.times do |v| | |
nsubsamples.times do |u| | |
cnt = cnt + 1 | |
wf = w.to_f | |
hf = h.to_f | |
xf = x.to_f | |
yf = y.to_f | |
uf = u.to_f | |
vf = v.to_f | |
px = (xf + (uf / nsf) - (wf / 2.0)) / (wf / 2.0) | |
py = -(yf + (vf / nsf) - (hf / 2.0)) / (hf / 2.0) | |
eye = Vec.new(px, py, -1.0).vnormalize | |
ray = Ray.new(Vec.new(0.0, 0.0, 0.0), eye) | |
isect = Isect.new | |
@spheres[0].intersect(ray, isect) | |
@spheres[1].intersect(ray, isect) | |
@spheres[2].intersect(ray, isect) | |
@plane.intersect(ray, isect) | |
if isect.hit then | |
col = ambient_occlusion(isect) | |
rad.x = rad.x + col.x | |
rad.y = rad.y + col.y | |
rad.z = rad.z + col.z | |
end | |
end | |
end | |
r = rad.x / (nsf * nsf) | |
g = rad.y / (nsf * nsf) | |
b = rad.z / (nsf * nsf) | |
printf("%c", clamp(r)) | |
printf("%c", clamp(g)) | |
printf("%c", clamp(b)) | |
end | |
nil | |
end | |
nil | |
end | |
end | |
alias printf_orig printf | |
def printf *args | |
end | |
# File.open("ao.ppm", "w") do |fp| | |
printf("P6\n") | |
printf("%d %d\n", IMAGE_WIDTH, IMAGE_HEIGHT) | |
printf("255\n", IMAGE_WIDTH, IMAGE_HEIGHT) | |
Scene.new.render(IMAGE_WIDTH, IMAGE_HEIGHT, NSUBSAMPLES) | |
# end | |
undef printf | |
alias printf printf_orig | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 54.58599109004717 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 55.576182116987184 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 55.796338962973095 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 55.292317920946516 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 55.461386871989816 | |
built-ruby 51.75369838497136 | |
built-ruby 51.12740166299045 | |
built-ruby 52.270437979954295 | |
built-ruby 50.30211525806226 | |
built-ruby 51.37324380793143 | |
----------------------------------------------------------- | |
app_erb | |
# | |
# Create many HTML strings with ERB. | |
# | |
require 'erb' | |
data = DATA.read | |
max = 15_000 | |
title = "hello world!" | |
content = "hello world!\n" * 10 | |
max.times{ | |
ERB.new(data).result(binding) | |
} | |
__END__ | |
<html> | |
<head> <%= title %> </head> | |
<body> | |
<h1> <%= title %> </h1> | |
<p> | |
<%= content %> | |
</p> | |
</body> | |
</html> | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.231968601932749 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.214464233024046 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.2946588959312066 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.2567868429468945 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.302027763915248 | |
built-ruby 2.3040525909746066 | |
built-ruby 2.373874614946544 | |
built-ruby 2.360743193072267 | |
built-ruby 2.296779378084466 | |
built-ruby 2.3394880950218067 | |
----------------------------------------------------------- | |
app_factorial | |
def fact(n) | |
if(n > 1) | |
n * fact(n-1) | |
else | |
1 | |
end | |
end | |
100.times { | |
fact(5000) | |
} | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8302856918890029 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8107500380137935 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8689422660972923 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8381959450198337 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8038355390308425 | |
built-ruby 0.8040747550548986 | |
built-ruby 0.8507883159909397 | |
built-ruby 0.798156816046685 | |
built-ruby 0.805755464010872 | |
built-ruby 0.8560758630046621 | |
----------------------------------------------------------- | |
app_fib | |
def fib n | |
if n < 3 | |
1 | |
else | |
fib(n-1) + fib(n-2) | |
end | |
end | |
fib(34) | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5394219270674512 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5461057809880003 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5409830220742151 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5282882750034332 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.542332053068094 | |
built-ruby 0.5090699099237099 | |
built-ruby 0.49279818299692124 | |
built-ruby 0.503557913005352 | |
built-ruby 0.529371326090768 | |
built-ruby 0.5138792649377137 | |
----------------------------------------------------------- | |
app_lc_fizzbuzz | |
# | |
# FizzBuzz program using only lambda calculus | |
# | |
# This program is quoted from | |
# "Understanding Computation" by Tom Stuart | |
# http://computationbook.com/ | |
# | |
# You can understand why this program works fine by reading this book. | |
# | |
solution = -> k { -> f { -> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> l { -> x { -> g { -> b { b }[-> p { p[-> x { -> y { x } }] }[l]][x][-> y { g[f[-> l { -> p { p[-> x { -> y { y } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][x][g]][-> l { -> p { p[-> x { -> y { x } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][y] }] } } } }][k][-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> l { -> x { -> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[l][f[x]] } }] } }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[m][n]][-> x { -> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[f[-> n { -> p { -> x { p[n[p][x]] } } }[m]][n]][m][x] }][-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]] } } }][-> p { -> x { p[x] } }][-> p { -> x { p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[x]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] } }]][-> n { -> b { b }[-> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> p { -> x { p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[x]]]]]]]]]]]]]]] } }]]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]][-> b { b }[-> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> p { -> x { p[p[p[x]]] } }]]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]][-> b { b }[-> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]]][-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> n { -> p { -> x { p[n[p][x]] } } }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]]]][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> n { -> l { -> x { -> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> l { -> x { -> g { -> b { b }[-> p { p[-> x { -> y { x } }] }[l]][x][-> y { g[f[-> l { -> p { p[-> x { -> y { y } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][x][g]][-> l { -> p { p[-> x { -> y { x } }] }[-> p { p[-> x { -> y { y } }] }[l]] }[l]][y] }] } } } }][l][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }[-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][x]][-> l { -> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> f { f[x][y] } } }[x][l]] } }] } }[-> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }[-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]]][-> x { -> y { -> f { f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> x { f[-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { -> n { -> p { -> x { p[n[p][x]] } } }[f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n]][x] }][-> p { -> x { x } }] } } }][n][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]][x] }]][-> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]] } }[n][m]][-> x { f[-> m { -> n { n[-> n { -> p { p[-> x { -> y { x } }] }[n[-> p { -> x { -> y { -> f { f[x][y] } } }[-> p { p[-> x { -> y { y } }] }[p]][-> n { -> p { -> x { p[n[p][x]] } } }[-> p { p[-> x { -> y { y } }] }[p]]] }][-> x { -> y { -> f { f[x][y] } } }[-> p { -> x { x } }][-> p { -> x { x } }]]] }][m] } }[m][n]][n][x] }][m] } } }][n][-> m { -> n { n[-> m { -> n { n[-> n { -> p { -> x { p[n[p][x]] } } }][m] } }[m]][-> p { -> x { x } }] } }[-> p { -> x { p[p[x]] } }][-> p { -> x { p[p[p[p[p[x]]]]] } }]]] } }][n]]]] }] | |
FIRST = -> l { LEFT[RIGHT[l]] } | |
IF = -> b { b } | |
LEFT = -> p { p[-> x { -> y { x } } ] } | |
RIGHT = -> p { p[-> x { -> y { y } } ] } | |
IS_EMPTY = LEFT | |
REST = -> l { RIGHT[RIGHT[l]] } | |
def to_integer(proc) | |
proc[-> n { n + 1 }][0] | |
end | |
def to_boolean(proc) | |
IF[proc][true][false] | |
end | |
def to_array(proc) | |
array = [] | |
until to_boolean(IS_EMPTY[proc]) | |
array.push(FIRST[proc]) | |
proc = REST[proc] | |
end | |
array | |
end | |
def to_char(c) | |
'0123456789BFiuz'.slice(to_integer(c)) | |
end | |
def to_string(s) | |
to_array(s).map { |c| to_char(c) }.join | |
end | |
answer = to_array(solution).map do |p| | |
to_string(p) | |
end | |
answer_ary = answer.to_a | |
# puts answer_ary | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 69.99791057093535 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 70.33638256508857 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 69.43688092799857 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 68.59378365206067 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 71.47225636104122 | |
built-ruby 40.99161151901353 | |
built-ruby 41.49508108908776 | |
built-ruby 42.590445040958 | |
built-ruby 44.49675606191158 | |
built-ruby 42.17322386696469 | |
----------------------------------------------------------- | |
app_mandelbrot | |
require 'complex' | |
def mandelbrot? z | |
i = 0 | |
while i<100 | |
i += 1 | |
z = z * z | |
return false if z.abs > 2 | |
end | |
true | |
end | |
ary = [] | |
(0..1000).each{|dx| | |
(0..1000).each{|dy| | |
x = dx / 50.0 | |
y = dy / 50.0 | |
c = Complex(x, y) | |
ary << c if mandelbrot?(c) | |
} | |
} | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4691719140391797 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4137170379981399 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.439615415991284 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4169191860128194 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4996583830798045 | |
built-ruby 1.4342095679603517 | |
built-ruby 1.4227394519839436 | |
built-ruby 1.4569037030451 | |
built-ruby 1.3930311589501798 | |
built-ruby 1.4416190939955413 | |
----------------------------------------------------------- | |
app_pentomino | |
#!/usr/local/bin/ruby | |
# This program is contributed by Shin Nishiyama | |
# modified by K.Sasada | |
NP = 5 | |
ROW = 8 + NP | |
COL = 8 | |
$p = [] | |
$b = [] | |
$no = 0 | |
def piece(n, a, nb) | |
nb.each{|x| | |
a[n] = x | |
if n == NP-1 | |
$p << [a.sort] | |
else | |
nbc=nb.dup | |
[-ROW, -1, 1, ROW].each{|d| | |
if x+d > 0 and not a.include?(x+d) and not nbc.include?(x+d) | |
nbc << x+d | |
end | |
} | |
nbc.delete x | |
piece(n+1,a[0..n],nbc) | |
end | |
} | |
end | |
def kikaku(a) | |
a.collect {|x| x - a[0]} | |
end | |
def ud(a) | |
kikaku(a.collect {|x| ((x+NP)%ROW)-ROW*((x+NP)/ROW) }.sort) | |
end | |
def rl(a) | |
kikaku(a.collect {|x| ROW*((x+NP)/ROW)+ROW-((x+NP)%ROW)}.sort) | |
end | |
def xy(a) | |
kikaku(a.collect {|x| ROW*((x+NP)%ROW) + (x+NP)/ROW }.sort) | |
end | |
def mkpieces | |
piece(0,[],[0]) | |
$p.each do |a| | |
a0 = a[0] | |
a[1] = ud(a0) | |
a[2] = rl(a0) | |
a[3] = ud(rl(a0)) | |
a[4] = xy(a0) | |
a[5] = ud(xy(a0)) | |
a[6] = rl(xy(a0)) | |
a[7] = ud(rl(xy(a0))) | |
a.sort! | |
a.uniq! | |
end | |
$p.uniq!.sort! {|x,y| x[0] <=> y[0] } | |
end | |
def mkboard | |
(0...ROW*COL).each{|i| | |
if i % ROW >= ROW-NP | |
$b[i] = -2 | |
else | |
$b[i] = -1 | |
end | |
$b[3*ROW+3]=$b[3*ROW+4]=$b[4*ROW+3]=$b[4*ROW+4]=-2 | |
} | |
end | |
def pboard | |
return # skip print | |
print "No. #$no\n" | |
(0...COL).each{|i| | |
print "|" | |
(0...ROW-NP).each{|j| | |
x = $b[i*ROW+j] | |
if x < 0 | |
print "..|" | |
else | |
printf "%2d|",x+1 | |
end | |
} | |
print "\n" | |
} | |
print "\n" | |
end | |
$pnum=[] | |
def setpiece(a,pos) | |
if a.length == $p.length then | |
$no += 1 | |
pboard | |
return | |
end | |
while $b[pos] != -1 | |
pos += 1 | |
end | |
($pnum - a).each do |i| | |
$p[i].each do |x| | |
f = 0 | |
x.each{|s| | |
if $b[pos+s] != -1 | |
f=1 | |
break | |
end | |
} | |
if f == 0 then | |
x.each{|s| | |
$b[pos+s] = i | |
} | |
a << i | |
setpiece(a.dup, pos) | |
a.pop | |
x.each{|s| | |
$b[pos+s] = -1 | |
} | |
end | |
end | |
end | |
end | |
mkpieces | |
mkboard | |
$p[4] = [$p[4][0]] | |
$pnum = (0...$p.length).to_a | |
setpiece([],0) | |
__END__ | |
# original | |
NP = 5 | |
ROW = 8 + NP | |
COL = 8 | |
$p = [] | |
$b = [] | |
$no = 0 | |
def piece(n,a,nb) | |
for x in nb | |
a[n] = x | |
if n == NP-1 | |
$p << [a.sort] | |
else | |
nbc=nb.dup | |
for d in [-ROW, -1, 1, ROW] | |
if x+d > 0 and not a.include?(x+d) and not nbc.include?(x+d) | |
nbc << x+d | |
end | |
end | |
nbc.delete x | |
piece(n+1,a[0..n],nbc) | |
end | |
end | |
end | |
def kikaku(a) | |
a.collect {|x| x - a[0]} | |
end | |
def ud(a) | |
kikaku(a.collect {|x| ((x+NP)%ROW)-ROW*((x+NP)/ROW) }.sort) | |
end | |
def rl(a) | |
kikaku(a.collect {|x| ROW*((x+NP)/ROW)+ROW-((x+NP)%ROW)}.sort) | |
end | |
def xy(a) | |
kikaku(a.collect {|x| ROW*((x+NP)%ROW) + (x+NP)/ROW }.sort) | |
end | |
def mkpieces | |
piece(0,[],[0]) | |
$p.each do |a| | |
a0 = a[0] | |
a[1] = ud(a0) | |
a[2] = rl(a0) | |
a[3] = ud(rl(a0)) | |
a[4] = xy(a0) | |
a[5] = ud(xy(a0)) | |
a[6] = rl(xy(a0)) | |
a[7] = ud(rl(xy(a0))) | |
a.sort! | |
a.uniq! | |
end | |
$p.uniq!.sort! {|x,y| x[0] <=> y[0] } | |
end | |
def mkboard | |
for i in 0...ROW*COL | |
if i % ROW >= ROW-NP | |
$b[i] = -2 | |
else | |
$b[i] = -1 | |
end | |
$b[3*ROW+3]=$b[3*ROW+4]=$b[4*ROW+3]=$b[4*ROW+4]=-2 | |
end | |
end | |
def pboard | |
print "No. #$no\n" | |
for i in 0...COL | |
print "|" | |
for j in 0...ROW-NP | |
x = $b[i*ROW+j] | |
if x < 0 | |
print "..|" | |
else | |
printf "%2d|",x+1 | |
end | |
end | |
print "\n" | |
end | |
print "\n" | |
end | |
$pnum=[] | |
def setpiece(a,pos) | |
if a.length == $p.length then | |
$no += 1 | |
pboard | |
return | |
end | |
while $b[pos] != -1 | |
pos += 1 | |
end | |
($pnum - a).each do |i| | |
$p[i].each do |x| | |
f = 0 | |
for s in x do | |
if $b[pos+s] != -1 | |
f=1 | |
break | |
end | |
end | |
if f == 0 then | |
for s in x do | |
$b[pos+s] = i | |
end | |
a << i | |
setpiece(a.dup, pos) | |
a.pop | |
for s in x do | |
$b[pos+s] = -1 | |
end | |
end | |
end | |
end | |
end | |
mkpieces | |
mkboard | |
$p[4] = [$p[4][0]] | |
$pnum = (0...$p.length).to_a | |
setpiece([],0) | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 16.955009859986603 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 17.016228512045927 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 17.123202687012963 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 17.22535213001538 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 17.16649117495399 | |
built-ruby 17.548675701022148 | |
built-ruby 17.592179167084396 | |
built-ruby 17.548861957970075 | |
built-ruby 17.845728643005714 | |
built-ruby 17.710411740932614 | |
----------------------------------------------------------- | |
app_raise | |
i = 0 | |
while i<300000 | |
i += 1 | |
begin | |
raise | |
rescue | |
end | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.24152075592428446 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.30898132803849876 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2403825499350205 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.25906085793394595 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.26233157294336706 | |
built-ruby 0.25932497496251017 | |
built-ruby 0.2245949930511415 | |
built-ruby 0.23073543095961213 | |
built-ruby 0.21433765604160726 | |
built-ruby 0.22223564109299332 | |
----------------------------------------------------------- | |
app_strconcat | |
i = 0 | |
while i<2_000_000 | |
"#{1+1} #{1+1} #{1+1}" | |
i += 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.099352365010418 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1284073980059475 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0681289340136573 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0726434210082516 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1101944859838113 | |
built-ruby 1.1025448340224102 | |
built-ruby 1.211157893994823 | |
built-ruby 1.1006269420031458 | |
built-ruby 1.0723086389480159 | |
built-ruby 1.114692494040355 | |
----------------------------------------------------------- | |
app_tak | |
def tak x, y, z | |
unless y < x | |
z | |
else | |
tak( tak(x-1, y, z), | |
tak(y-1, z, x), | |
tak(z-1, x, y)) | |
end | |
end | |
tak(18, 9, 0) | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7760888659395278 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7183313800487667 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.800829699030146 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7779099229956046 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7689379589864984 | |
built-ruby 0.7379660790320486 | |
built-ruby 0.7507547120330855 | |
built-ruby 0.7746493939775974 | |
built-ruby 0.7573163129854947 | |
built-ruby 0.7513459080364555 | |
----------------------------------------------------------- | |
app_tarai | |
def tarai( x, y, z ) | |
if x <= y | |
then y | |
else tarai(tarai(x-1, y, z), | |
tarai(y-1, z, x), | |
tarai(z-1, x, y)) | |
end | |
end | |
tarai(12, 6, 0) | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6000802039634436 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6422550959978253 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6254906730027869 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6682855940889567 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6114415570627898 | |
built-ruby 0.6225703150266781 | |
built-ruby 0.619686861988157 | |
built-ruby 0.6119015109725296 | |
built-ruby 0.6365446960553527 | |
built-ruby 0.6483560899505392 | |
----------------------------------------------------------- | |
app_uri | |
require 'uri' | |
100_000.times{ | |
uri = URI.parse('http://www.ruby-lang.org') | |
uri.scheme | |
uri.host | |
uri.port | |
} | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6080217339331284 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5974279250949621 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6283238979522139 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5964365160325542 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5917318909196183 | |
built-ruby 0.5834868639940396 | |
built-ruby 0.5648214350221679 | |
built-ruby 0.6081726279808208 | |
built-ruby 0.5777335789753124 | |
built-ruby 0.5967385330004618 | |
----------------------------------------------------------- | |
array_shift | |
require 'benchmark' | |
Benchmark.bm do |x| | |
[10_000,1_000_000,100_000_000].each do |n| | |
ary = Array.new(n,0) | |
GC.start | |
x.report("#{n}:shift"){ ary.shift } | |
(0..4).each do |i| | |
ary = Array.new(n,0) | |
GC.start | |
x.report("#{n}:shift(#{i})"){ ary.shift(i) } | |
end | |
end | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 19.911575963022187 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 21.80540126003325 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 21.684410477988422 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 19.361100711044855 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 20.460079101030715 | |
built-ruby 20.590318536036648 | |
built-ruby 20.145105980103835 | |
built-ruby 18.954186240094714 | |
built-ruby 18.368444312014617 | |
built-ruby 19.730205620988272 | |
----------------------------------------------------------- | |
hash_aref_dsym | |
h = {} | |
syms = ('a'..'z').map { |s| s.to_sym } | |
syms.each { |s| h[s] = 1 } | |
200_000.times { syms.each { |s| h[s] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4216823069145903 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3622758809942752 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.38479660102166235 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.40343340998515487 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.49036661093123257 | |
built-ruby 0.43174306803848594 | |
built-ruby 0.5595700640697032 | |
built-ruby 0.5306916529079899 | |
built-ruby 0.5160241100238636 | |
built-ruby 0.39117593702394515 | |
----------------------------------------------------------- | |
hash_aref_dsym_long | |
# [ruby-core:70129] [Bug #11396] | |
collection_size = 200000 | |
sample_size = 10000 | |
values = (1..collection_size).to_a.map do |x| | |
"THIS IS A LONGER STRING THAT IS ALSO UNIQUE #{x}" | |
end | |
symbol_hash = {} | |
values.each do |x| | |
symbol_hash[x.to_sym] = 1 | |
end | |
# use the same samples each time to minimize deviations | |
rng = Random.new(0) | |
symbol_sample_array = values.sample(sample_size, random: rng).map(&:to_sym) | |
3000.times do | |
symbol_sample_array.each { |x| symbol_hash[x] } | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 8.994142417912371 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 8.65070200106129 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 8.894787893048488 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 8.891105056973174 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 8.985472270986065 | |
built-ruby 9.263988000922836 | |
built-ruby 8.880853733047843 | |
built-ruby 8.88276363699697 | |
built-ruby 8.975527776987292 | |
built-ruby 9.016328673926182 | |
----------------------------------------------------------- | |
hash_aref_fix | |
h = {} | |
nums = (1..26).to_a | |
nums.each { |i| h[i] = i } | |
200_000.times { nums.each { |s| h[s] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.37598705396521837 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.365062219905667 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.41727619199082255 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4163406129227951 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4131853310391307 | |
built-ruby 0.42576511297374964 | |
built-ruby 0.39972475508693606 | |
built-ruby 0.4207646220456809 | |
built-ruby 0.42259231791831553 | |
built-ruby 0.4202495509525761 | |
----------------------------------------------------------- | |
hash_aref_flo | |
h = {} | |
strs = [*1..10000].map! {|i| i.fdiv(10)} | |
strs.each { |s| h[s] = s } | |
50.times { strs.each { |s| h[s] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.11718685796950012 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.11380171892233193 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.08189995994325727 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.07708744995761663 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.09865439892746508 | |
built-ruby 0.11252881400287151 | |
built-ruby 0.08053674502298236 | |
built-ruby 0.07900785398669541 | |
built-ruby 0.11016465292777866 | |
built-ruby 0.11145737406332046 | |
----------------------------------------------------------- | |
hash_aref_miss | |
h = {} | |
strs = ('a'..'z').to_a.map!(&:freeze) | |
strs.each { |s| h[s] = s } | |
strs = ('A'..'Z').to_a | |
200_000.times { strs.each { |s| h[s] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6566751280333847 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5181243579136208 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4812287100357935 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4952475589234382 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5520137930288911 | |
built-ruby 0.5301608719164506 | |
built-ruby 0.7099478869931772 | |
built-ruby 0.687668439000845 | |
built-ruby 0.505970490979962 | |
built-ruby 0.6379513390129432 | |
----------------------------------------------------------- | |
hash_aref_str | |
h = {} | |
strs = ('a'..'z').to_a.map!(&:freeze) | |
strs.each { |s| h[s] = s } | |
200_000.times { strs.each { |s| h[s] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.46142047201283276 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.557503585005179 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.44997511396650225 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.473411327926442 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4952690149657428 | |
built-ruby 0.5121987810125574 | |
built-ruby 0.5139237380353734 | |
built-ruby 0.5129490919644013 | |
built-ruby 0.549338715034537 | |
built-ruby 0.510490596992895 | |
----------------------------------------------------------- | |
hash_aref_sym | |
h = {} | |
syms = ('a'..'z').to_a | |
begin | |
syms = eval("%i[#{syms.join(' ')}]") | |
rescue SyntaxError # <= 1.9.3 | |
syms.map!(&:to_sym) | |
end | |
syms.each { |s| h[s] = s } | |
200_000.times { syms.each { |s| h[s] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3888717930531129 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.35667734197340906 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.35198676493018866 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.35674102103803307 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.40656316094100475 | |
built-ruby 0.37652272009290755 | |
built-ruby 0.38751485000830144 | |
built-ruby 0.3706149799982086 | |
built-ruby 0.3702603030251339 | |
built-ruby 0.3512671149801463 | |
----------------------------------------------------------- | |
hash_aref_sym_long | |
h = {} | |
syms = %w[puts warn syswrite write stat bacon lettuce tomato | |
some symbols in this array may already be interned others should not be | |
hash browns make good breakfast but not cooked using prime numbers | |
shift for division entries delete_if keys exist? | |
] | |
begin | |
syms = eval("%i[#{syms.join(' ')}]") | |
rescue SyntaxError # <= 1.9.3 | |
syms.map!(&:to_sym) | |
end | |
syms.each { |s| h[s] = s } | |
200_000.times { syms.each { |s| h[s] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5792624419555068 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.560205984977074 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.541156632010825 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5849411159288138 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5847152499482036 | |
built-ruby 0.5648888240102679 | |
built-ruby 0.5205608840333298 | |
built-ruby 0.5261825050693005 | |
built-ruby 0.5629314871039242 | |
built-ruby 0.5783154160017148 | |
----------------------------------------------------------- | |
hash_flatten | |
h = {} | |
10000.times do |i| | |
h[i] = nil | |
end | |
1000.times do | |
h.flatten | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3427213099785149 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3069341860245913 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.34275468497071415 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.38032072596251965 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.346936195041053 | |
built-ruby 0.32654421601910144 | |
built-ruby 0.3373371420893818 | |
built-ruby 0.34255180205218494 | |
built-ruby 0.3248691939515993 | |
built-ruby 0.34191841701976955 | |
----------------------------------------------------------- | |
hash_ident_flo | |
h = {}.compare_by_identity | |
strs = (1..10000).to_a.map!(&:to_f) | |
strs.each { |s| h[s] = s } | |
50.times { strs.each { |s| h[s] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.04220124601852149 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.041269097942858934 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.04389087401796132 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.04291684599593282 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.07074739702511579 | |
built-ruby 0.05692592798732221 | |
built-ruby 0.044749675085768104 | |
built-ruby 0.0664445529691875 | |
built-ruby 0.07258922001346946 | |
built-ruby 0.07019294996280223 | |
----------------------------------------------------------- | |
hash_ident_num | |
h = {}.compare_by_identity | |
nums = (1..26).to_a | |
nums.each { |n| h[n] = n } | |
200_000.times { nums.each { |n| h[n] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.39377539709676057 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.39119664498139173 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3880777000449598 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.40493444295134395 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.36523314204532653 | |
built-ruby 0.3929379280889407 | |
built-ruby 0.34873612003866583 | |
built-ruby 0.3442114370409399 | |
built-ruby 0.38300986506510526 | |
built-ruby 0.37529788399115205 | |
----------------------------------------------------------- | |
hash_ident_obj | |
h = {}.compare_by_identity | |
objs = 26.times.map { Object.new } | |
objs.each { |o| h[o] = o } | |
200_000.times { objs.each { |o| h[o] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3828392189461738 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.35609906795434654 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3869356900686398 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.38341773208230734 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.37513233406934887 | |
built-ruby 0.36865005106665194 | |
built-ruby 0.4118203339166939 | |
built-ruby 0.35567324492149055 | |
built-ruby 0.37416579702403396 | |
built-ruby 0.3900904100155458 | |
----------------------------------------------------------- | |
hash_ident_str | |
h = {}.compare_by_identity | |
strs = ('a'..'z').to_a | |
strs.each { |s| h[s] = s } | |
200_000.times { strs.each { |s| h[s] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.377036583959125 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3820425069425255 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.36399687302764505 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.34358865895774215 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.34478977404069155 | |
built-ruby 0.3856695689028129 | |
built-ruby 0.3960615099640563 | |
built-ruby 0.39091065991669893 | |
built-ruby 0.362755179987289 | |
built-ruby 0.48463089496362954 | |
----------------------------------------------------------- | |
hash_ident_sym | |
h = {}.compare_by_identity | |
syms = ('a'..'z').to_a.map(&:to_sym) | |
syms.each { |s| h[s] = s } | |
200_000.times { syms.each { |s| h[s] } } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3676063900347799 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.372383851907216 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3768876070389524 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3810834060423076 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3695543850772083 | |
built-ruby 0.40730858489405364 | |
built-ruby 0.35844991891644895 | |
built-ruby 0.3562260299222544 | |
built-ruby 0.36219201888889074 | |
built-ruby 0.3705180719261989 | |
----------------------------------------------------------- | |
hash_keys | |
h = {} | |
10000.times do |i| | |
h[i] = nil | |
end | |
5000.times do | |
h.keys | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3813573819352314 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.40435454109683633 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.36419785604812205 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.36185255693271756 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.37647308001760393 | |
built-ruby 0.37183589406777173 | |
built-ruby 0.37212479999288917 | |
built-ruby 0.3915642349747941 | |
built-ruby 0.3662926279939711 | |
built-ruby 0.3848387829493731 | |
----------------------------------------------------------- | |
hash_shift | |
h = {} | |
10000.times do |i| | |
h[i] = nil | |
end | |
50000.times do | |
k, v = h.shift | |
h[k] = v | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.019978645024821162 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.02057298901490867 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.021030289004556835 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.02016332291532308 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.020496617071330547 | |
built-ruby 0.019983322941698134 | |
built-ruby 0.019883542088791728 | |
built-ruby 0.01988018094561994 | |
built-ruby 0.019127018051221967 | |
built-ruby 0.019923339947126806 | |
----------------------------------------------------------- | |
hash_shift_u16 | |
h = {} | |
(16384..65536).each do |i| | |
h[i] = nil | |
end | |
300000.times do | |
k, v = h.shift | |
h[k] = v | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.10453401308041066 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.09176352899521589 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.11688991403207183 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.09428807406220585 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.0933125379960984 | |
built-ruby 0.0919919959269464 | |
built-ruby 0.1384998329449445 | |
built-ruby 0.09584043198265135 | |
built-ruby 0.142563764937222 | |
built-ruby 0.14312137803062797 | |
----------------------------------------------------------- | |
hash_shift_u24 | |
h = {} | |
(0xff4000..0xffffff).each do |i| | |
h[i] = nil | |
end | |
300000.times do | |
k, v = h.shift | |
h[k] = v | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.1365325200604275 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.11648659699130803 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.09805822500493377 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.09307972399983555 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.09942812204826623 | |
built-ruby 0.13245002599433064 | |
built-ruby 0.13298956002108753 | |
built-ruby 0.09465779503807425 | |
built-ruby 0.1013404109980911 | |
built-ruby 0.13682444905862212 | |
----------------------------------------------------------- | |
hash_shift_u32 | |
h = {} | |
(0xffff4000..0xffffffff).each do |i| | |
h[i] = nil | |
end | |
300000.times do | |
k, v = h.shift | |
h[k] = v | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.08892942301463336 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.08826780295930803 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.10507124394644052 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.0913004920585081 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.13256571907550097 | |
built-ruby 0.09448003501165658 | |
built-ruby 0.1459165009437129 | |
built-ruby 0.09830889292061329 | |
built-ruby 0.09352237393613905 | |
built-ruby 0.13785196701064706 | |
----------------------------------------------------------- | |
hash_to_proc | |
h = {} | |
10000.times do |i| | |
h[i] = nil | |
end | |
5000.times do |i| | |
[i].map(&h) | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.019653267925605178 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.01671880902722478 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.015707271988503635 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.01917582901660353 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.016913854982703924 | |
built-ruby 0.016896598041057587 | |
built-ruby 0.01782079297117889 | |
built-ruby 0.018575310008600354 | |
built-ruby 0.016450647031888366 | |
built-ruby 0.010085696005262434 | |
----------------------------------------------------------- | |
hash_values | |
h = {} | |
10000.times do |i| | |
h[i] = nil | |
end | |
5000.times do | |
h.values | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.38122058392036706 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.34331048699095845 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3440139730228111 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3586773299612105 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.35639152803923935 | |
built-ruby 0.3473863329272717 | |
built-ruby 0.35828115697950125 | |
built-ruby 0.3558147290023044 | |
built-ruby 0.3774512440431863 | |
built-ruby 0.40638430789113045 | |
----------------------------------------------------------- | |
io_file_create | |
# | |
# Create files | |
# | |
max = 200_000 | |
file = './tmpfile_of_bm_io_file_create' | |
max.times{ | |
f = open(file, 'w') | |
f.close#(true) | |
} | |
File.unlink(file) | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0968290109885857 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.069951456040144 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1728365051094443 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1180928848916665 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1327887700172141 | |
built-ruby 1.245755268028006 | |
built-ruby 1.1043767239898443 | |
built-ruby 1.1141724679619074 | |
built-ruby 1.1341513060033321 | |
built-ruby 1.1506679240847006 | |
----------------------------------------------------------- | |
io_file_read | |
# | |
# Seek and Read file. | |
# | |
require 'tempfile' | |
max = 200_000 | |
str = "Hello world! " * 1000 | |
f = Tempfile.new('yarv-benchmark') | |
f.write str | |
max.times{ | |
f.seek 0 | |
f.read | |
} | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4777622310211882 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4042066799011081 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4235800999449566 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3972327669616789 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4454854049254209 | |
built-ruby 1.452328918967396 | |
built-ruby 1.4763240709435195 | |
built-ruby 1.4212326299166307 | |
built-ruby 1.4206862730206922 | |
built-ruby 1.4323099629255012 | |
----------------------------------------------------------- | |
io_file_write | |
# | |
# Seek and Write file. | |
# | |
require 'tempfile' | |
max = 200_000 | |
str = "Hello world! " * 1000 | |
f = Tempfile.new('yarv-benchmark') | |
max.times{ | |
f.seek 0 | |
f.write str | |
} | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5536080140154809 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5973453510086983 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5510142010170966 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5829400019720197 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5641764220781624 | |
built-ruby 0.5483221609611064 | |
built-ruby 0.5867528859525919 | |
built-ruby 0.6009624869329855 | |
built-ruby 0.5745283620199189 | |
built-ruby 0.5461939809611067 | |
----------------------------------------------------------- | |
io_nonblock_noex | |
nr = 1_000_000 | |
i = 0 | |
msg = '.' | |
buf = '.' | |
noex = { exception: false } | |
begin | |
r, w = IO.pipe | |
while i < nr | |
i += 1 | |
w.write_nonblock(msg, noex) | |
r.read_nonblock(1, buf, noex) | |
end | |
rescue ArgumentError # old Rubies | |
while i < nr | |
i += 1 | |
w.write_nonblock(msg) | |
r.read_nonblock(1, buf) | |
end | |
ensure | |
r.close | |
w.close | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] `./miniruby55727 -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex.rb' exited with abnormal status (pid 29950 exit 1) | |
0 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] `./miniruby55727 -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex.rb' exited with abnormal status (pid 29952 exit 1) | |
0 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] `./miniruby55727 -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex.rb' exited with abnormal status (pid 29954 exit 1) | |
0 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] `./miniruby55727 -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex.rb' exited with abnormal status (pid 29956 exit 1) | |
0 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] `./miniruby55727 -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex.rb' exited with abnormal status (pid 29958 exit 1) | |
0 | |
built-ruby `./miniruby -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex.rb' exited with abnormal status (pid 29960 exit 1) | |
0 | |
built-ruby `./miniruby -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex.rb' exited with abnormal status (pid 29962 exit 1) | |
0 | |
built-ruby `./miniruby -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex.rb' exited with abnormal status (pid 29964 exit 1) | |
0 | |
built-ruby `./miniruby -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex.rb' exited with abnormal status (pid 29966 exit 1) | |
0 | |
built-ruby `./miniruby -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex.rb' exited with abnormal status (pid 29968 exit 1) | |
0 | |
----------------------------------------------------------- | |
io_nonblock_noex2 | |
nr = 1_000_000 | |
i = 0 | |
msg = '.' | |
buf = '.' | |
begin | |
r, w = IO.pipe | |
while i < nr | |
i += 1 | |
w.write_nonblock(msg, exception: false) | |
r.read_nonblock(1, buf, exception: false) | |
end | |
rescue ArgumentError # old Rubies | |
while i < nr | |
i += 1 | |
w.write_nonblock(msg) | |
r.read_nonblock(1, buf) | |
end | |
ensure | |
r.close | |
w.close | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] `./miniruby55727 -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex2.rb' exited with abnormal status (pid 29970 exit 1) | |
0 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] `./miniruby55727 -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex2.rb' exited with abnormal status (pid 29972 exit 1) | |
0 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] `./miniruby55727 -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex2.rb' exited with abnormal status (pid 29974 exit 1) | |
0 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] `./miniruby55727 -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex2.rb' exited with abnormal status (pid 29976 exit 1) | |
0 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] `./miniruby55727 -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex2.rb' exited with abnormal status (pid 29978 exit 1) | |
0 | |
built-ruby `./miniruby -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex2.rb' exited with abnormal status (pid 29980 exit 1) | |
0 | |
built-ruby `./miniruby -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex2.rb' exited with abnormal status (pid 29982 exit 1) | |
0 | |
built-ruby `./miniruby -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex2.rb' exited with abnormal status (pid 29984 exit 1) | |
0 | |
built-ruby `./miniruby -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex2.rb' exited with abnormal status (pid 29986 exit 1) | |
0 | |
built-ruby `./miniruby -I./lib -I. -I.ext/common --disable-gem ./benchmark/bm_io_nonblock_noex2.rb' exited with abnormal status (pid 29988 exit 1) | |
0 | |
----------------------------------------------------------- | |
io_select | |
# IO.select performance | |
w = [ IO.pipe[1] ]; | |
nr = 1000000 | |
nr.times { | |
IO.select nil, w | |
} | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3566845810273662 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3276568519650027 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3886774969287217 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4759572820039466 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.381032899953425 | |
built-ruby 1.4428902280051261 | |
built-ruby 1.398780834977515 | |
built-ruby 1.4073024929966778 | |
built-ruby 1.403941371012479 | |
built-ruby 1.390713831060566 | |
----------------------------------------------------------- | |
io_select2 | |
# IO.select performance. worst case of single fd. | |
ios = [] | |
nr = 1000000 | |
if defined?(Process::RLIMIT_NOFILE) | |
max = Process.getrlimit(Process::RLIMIT_NOFILE)[0] | |
else | |
max = 64 | |
end | |
puts "max fd: #{max} (results not apparent with <= 1024 max fd)" | |
((max / 2) - 10).times do | |
ios.concat IO.pipe | |
end | |
last = [ ios[-1] ] | |
puts "last IO: #{last[0].inspect}" | |
nr.times do | |
IO.select nil, last | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.6995966200483963 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.6652121299412102 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.6420642510056496 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.8304848399711773 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.6703923679888248 | |
built-ruby 1.6714988009771332 | |
built-ruby 1.661516672000289 | |
built-ruby 1.658023179974407 | |
built-ruby 1.7248587399953976 | |
built-ruby 1.6729385469807312 | |
----------------------------------------------------------- | |
io_select3 | |
# IO.select performance. a lot of fd | |
ios = [] | |
nr = 100 | |
if defined?(Process::RLIMIT_NOFILE) | |
max = Process.getrlimit(Process::RLIMIT_NOFILE)[0] | |
else | |
max = 64 | |
end | |
puts "max fd: #{max} (results not apparent with <= 1024 max fd)" | |
(max - 10).times do | |
r, w = IO.pipe | |
r.close | |
ios.push w | |
end | |
nr.times do | |
IO.select nil, ios | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.08045057998970151 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.08171069796662778 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.08577974699437618 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.08378621900919825 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.09031901403795928 | |
built-ruby 0.09006700303871185 | |
built-ruby 0.07957196491770446 | |
built-ruby 0.08113130403216928 | |
built-ruby 0.07871861499734223 | |
built-ruby 0.08099054102785885 | |
----------------------------------------------------------- | |
loop_for | |
for i in 1..30_000_000 | |
# | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.429033393971622 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3902404700638726 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3368758759461343 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.5224818449933082 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3832816269714385 | |
built-ruby 1.4056512729730457 | |
built-ruby 1.3982130440417677 | |
built-ruby 1.4856738760136068 | |
built-ruby 1.4355269520310685 | |
built-ruby 1.3960542739368975 | |
----------------------------------------------------------- | |
loop_generator | |
max = 600000 | |
if defined? Fiber | |
gen = (1..max).each | |
loop do | |
gen.next | |
end | |
else | |
require 'generator' | |
gen = Generator.new((0..max)) | |
while gen.next? | |
gen.next | |
end | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.447983055957593 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.43713122291956097 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.41632595006376505 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.413728442043066 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.43117495195474476 | |
built-ruby 0.3936361169908196 | |
built-ruby 0.41520697495434433 | |
built-ruby 0.3813484450802207 | |
built-ruby 0.4186007340904325 | |
built-ruby 0.46606297697871923 | |
----------------------------------------------------------- | |
loop_times | |
30_000_000.times{|e|} | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2660569730214775 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.288977800984867 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2790794249158353 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2557534169172868 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.242581072030589 | |
built-ruby 1.367729538003914 | |
built-ruby 1.2490719420602545 | |
built-ruby 1.2537770349299535 | |
built-ruby 1.3036859730491415 | |
built-ruby 1.315647570998408 | |
----------------------------------------------------------- | |
loop_whileloop | |
i = 0 | |
while i<30_000_000 # benchmark loop 1 | |
i += 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6696008009603247 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6613349430263042 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6545510729774833 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7210862779757008 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6868640170432627 | |
built-ruby 0.7538669649511576 | |
built-ruby 0.6594554899493232 | |
built-ruby 0.6867847840767354 | |
built-ruby 0.7034585719229653 | |
built-ruby 0.676485852105543 | |
----------------------------------------------------------- | |
loop_whileloop2 | |
i = 0 | |
while i< 6_000_000 # benchmark loop 2 | |
i += 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.16582438093610108 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.1785859070951119 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.1345876029226929 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.19371888297609985 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.1576415990712121 | |
built-ruby 0.18836930592078716 | |
built-ruby 0.17945012100972235 | |
built-ruby 0.13904708600603044 | |
built-ruby 0.13976143905892968 | |
built-ruby 0.16039950295817107 | |
----------------------------------------------------------- | |
marshal_dump_flo | |
bug10761 = 10000.times.map { |x| x.to_f } | |
100.times { Marshal.dump(bug10761) } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.40514840092509985 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4423090369673446 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4337517569074407 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4403481970075518 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3930218250025064 | |
built-ruby 0.4278980160597712 | |
built-ruby 0.43506750697270036 | |
built-ruby 0.4263163349824026 | |
built-ruby 0.42774789698887616 | |
built-ruby 0.4529707379406318 | |
----------------------------------------------------------- | |
marshal_dump_load_geniv | |
a = '' | |
a.instance_eval do | |
@a = :a | |
@b = :b | |
@c = :c | |
end | |
100000.times do | |
a = Marshal.load(Marshal.dump(a)) | |
end | |
#p(a.instance_eval { @a == :a && @b == :b && @c == :c }) | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6123521019471809 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6119896658929065 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6105287390528247 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6229553610319272 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6130104489857331 | |
built-ruby 0.6296117239398882 | |
built-ruby 0.6413133019814268 | |
built-ruby 0.589495872030966 | |
built-ruby 0.597406764049083 | |
built-ruby 0.5956406740006059 | |
----------------------------------------------------------- | |
marshal_dump_load_time | |
100000.times { Marshal.load(Marshal.dump(Time.now)) } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.700435527949594 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.7273683469975367 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.6878731369506568 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.8823049339698628 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.695577287930064 | |
built-ruby 1.7563206269405782 | |
built-ruby 1.874093962018378 | |
built-ruby 1.7417739329393953 | |
built-ruby 1.8114637369289994 | |
built-ruby 1.750103313010186 | |
----------------------------------------------------------- | |
require | |
$:.push File.join(File.dirname(__FILE__), "bm_require.data") | |
1.upto(10000) do |i| | |
require "c#{i}" | |
end | |
$:.pop | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0619833109667525 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9308968300465494 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0666463939705864 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8810079169925302 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8796678589424118 | |
built-ruby 0.9250150509178638 | |
built-ruby 0.8820322109386325 | |
built-ruby 0.8508778579998761 | |
built-ruby 0.9202019539661705 | |
built-ruby 0.9012398619670421 | |
----------------------------------------------------------- | |
require_thread | |
$:.push File.join(File.dirname(__FILE__), "bm_require.data") | |
i=0 | |
t = Thread.new do | |
while true | |
i = i+1 # dummy loop | |
end | |
end | |
1.upto(100) do |i| | |
require "c#{i}" | |
end | |
$:.pop | |
t.kill | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.21662832389120013 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.22078900691121817 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5179030389990658 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5129538390319794 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5115444009425119 | |
built-ruby 0.31828783394303173 | |
built-ruby 0.32342322205659 | |
built-ruby 0.21796219993848354 | |
built-ruby 0.4137510540895164 | |
built-ruby 0.1225852380739525 | |
----------------------------------------------------------- | |
securerandom | |
require "securerandom" | |
20_0000.times do | |
SecureRandom.random_number(100) | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.26040642301086336 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2563073959900066 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2603783579543233 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.27299292106181383 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2926094400463626 | |
built-ruby 0.2890160030219704 | |
built-ruby 0.2857340909540653 | |
built-ruby 0.29148439900018275 | |
built-ruby 0.24334233906120062 | |
built-ruby 0.28515519900247455 | |
----------------------------------------------------------- | |
so_ackermann | |
#!/usr/bin/ruby | |
# -*- mode: ruby -*- | |
# $Id: ackermann-ruby.code,v 1.4 2004/11/13 07:40:41 bfulgham Exp $ | |
# http://www.bagley.org/~doug/shootout/ | |
def ack(m, n) | |
if m == 0 then | |
n + 1 | |
elsif n == 0 then | |
ack(m - 1, 1) | |
else | |
ack(m - 1, ack(m, n - 1)) | |
end | |
end | |
NUM = 9 | |
ack(3, NUM) | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7351798920426518 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6416415710700676 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6314938109135255 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6161993889836594 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6308393200160936 | |
built-ruby 0.6026810819748789 | |
built-ruby 0.5840895769651979 | |
built-ruby 0.5894482340663671 | |
built-ruby 0.5874529340071604 | |
built-ruby 0.563191408989951 | |
----------------------------------------------------------- | |
so_array | |
#!/usr/bin/ruby | |
# -*- mode: ruby -*- | |
# $Id: ary-ruby.code,v 1.4 2004/11/13 07:41:27 bfulgham Exp $ | |
# http://www.bagley.org/~doug/shootout/ | |
# with help from Paul Brannan and Mark Hubbart | |
n = 9000 # Integer(ARGV.shift || 1) | |
x = Array.new(n) | |
y = Array.new(n, 0) | |
n.times{|bi| | |
x[bi] = bi + 1 | |
} | |
(0 .. 999).each do |e| | |
(n-1).step(0,-1) do |bi| | |
y[bi] += x.at(bi) | |
end | |
end | |
# puts "#{y.first} #{y.last}" | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9406678340164945 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9825775140197948 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9287008650135249 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9349297150038183 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9208299829624593 | |
built-ruby 0.9324882669607177 | |
built-ruby 0.938745960011147 | |
built-ruby 1.01670901698526 | |
built-ruby 0.9396806108998135 | |
built-ruby 0.9004901159787551 | |
----------------------------------------------------------- | |
so_binary_trees | |
# The Computer Language Shootout Benchmarks | |
# http://shootout.alioth.debian.org | |
# | |
# contributed by Jesse Millikan | |
# disable output | |
alias puts_orig puts | |
def puts str | |
# disable puts | |
end | |
def item_check(tree) | |
if tree[0] == nil | |
tree[1] | |
else | |
tree[1] + item_check(tree[0]) - item_check(tree[2]) | |
end | |
end | |
def bottom_up_tree(item, depth) | |
if depth > 0 | |
item_item = 2 * item | |
depth -= 1 | |
[bottom_up_tree(item_item - 1, depth), item, bottom_up_tree(item_item, depth)] | |
else | |
[nil, item, nil] | |
end | |
end | |
max_depth = 16 # ARGV[0].to_i | |
min_depth = 4 | |
max_depth = min_depth + 2 if min_depth + 2 > max_depth | |
stretch_depth = max_depth + 1 | |
stretch_tree = bottom_up_tree(0, stretch_depth) | |
puts "stretch tree of depth #{stretch_depth}\t check: #{item_check(stretch_tree)}" | |
stretch_tree = nil | |
long_lived_tree = bottom_up_tree(0, max_depth) | |
min_depth.step(max_depth + 1, 2) do |depth| | |
iterations = 2**(max_depth - depth + min_depth) | |
check = 0 | |
for i in 1..iterations | |
temp_tree = bottom_up_tree(i, depth) | |
check += item_check(temp_tree) | |
temp_tree = bottom_up_tree(-i, depth) | |
check += item_check(temp_tree) | |
end | |
puts "#{iterations * 2}\t trees of depth #{depth}\t check: #{check}" | |
end | |
puts "long lived tree of depth #{max_depth}\t check: #{item_check(long_lived_tree)}" | |
undef puts | |
alias puts puts_orig | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.260964497923851 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.2369194839848205 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.4077904800651595 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.403173052938655 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.439292576978914 | |
built-ruby 5.983900416991673 | |
built-ruby 6.202562858001329 | |
built-ruby 6.169638277031481 | |
built-ruby 6.154955621925183 | |
built-ruby 6.205964269000106 | |
----------------------------------------------------------- | |
so_concatenate | |
#!/usr/bin/ruby | |
# -*- mode: ruby -*- | |
# $Id: strcat-ruby.code,v 1.4 2004/11/13 07:43:28 bfulgham Exp $ | |
# http://www.bagley.org/~doug/shootout/ | |
# based on code from Aristarkh A Zagorodnikov and Dat Nguyen | |
STUFF = "hello\n" | |
i = 0 | |
while i<10 | |
i += 1 | |
hello = '' | |
4_000_000.times do |e| | |
hello << STUFF | |
end | |
end | |
# puts hello.length | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.001141563989222 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.09834510309156 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.112204045988619 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.056181942927651 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.053268599906005 | |
built-ruby 4.231184215983376 | |
built-ruby 4.214553599944338 | |
built-ruby 4.225530072930269 | |
built-ruby 4.23357527400367 | |
built-ruby 4.446332956082188 | |
----------------------------------------------------------- | |
so_count_words | |
#!/usr/bin/ruby | |
# -*- mode: ruby -*- | |
# $Id: wc-ruby.code,v 1.4 2004/11/13 07:43:32 bfulgham Exp $ | |
# http://www.bagley.org/~doug/shootout/ | |
# with help from Paul Brannan | |
input = open(File.join(File.dirname($0), 'wc.input'), 'rb') | |
nl = nw = nc = 0 | |
while true | |
tmp = input.read(4096) or break | |
data = tmp << (input.gets || "") | |
nc += data.length | |
nl += data.count("\n") | |
((data.strip! || data).tr!("\n", " ") || data).squeeze! | |
nw += data.count(" ") + 1 | |
end | |
# STDERR.puts "#{nl} #{nw} #{nc}" | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.18317602504976094 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.16097911505494267 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.1944847139529884 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.16829874098766595 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.1914049789775163 | |
built-ruby 0.1907938700169325 | |
built-ruby 0.15760852908715606 | |
built-ruby 0.15018033992964774 | |
built-ruby 0.1822699890471995 | |
built-ruby 0.14878833096008748 | |
----------------------------------------------------------- | |
so_exception | |
#!/usr/bin/ruby | |
# -*- mode: ruby -*- | |
# $Id: except-ruby.code,v 1.4 2004/11/13 07:41:33 bfulgham Exp $ | |
# http://www.bagley.org/~doug/shootout/ | |
$HI = 0 | |
$LO = 0 | |
NUM = 250000 # Integer(ARGV[0] || 1) | |
class Lo_Exception < Exception | |
def initialize(num) | |
@value = num | |
end | |
end | |
class Hi_Exception < Exception | |
def initialize(num) | |
@value = num | |
end | |
end | |
def some_function(num) | |
begin | |
hi_function(num) | |
rescue | |
print "We shouldn't get here, exception is: #{$!.type}\n" | |
end | |
end | |
def hi_function(num) | |
begin | |
lo_function(num) | |
rescue Hi_Exception | |
$HI = $HI + 1 | |
end | |
end | |
def lo_function(num) | |
begin | |
blowup(num) | |
rescue Lo_Exception | |
$LO = $LO + 1 | |
end | |
end | |
def blowup(num) | |
if num % 2 == 0 | |
raise Lo_Exception.new(num) | |
else | |
raise Hi_Exception.new(num) | |
end | |
end | |
i = 1 | |
max = NUM+1 | |
while i < max | |
i += 1 | |
some_function(i+1) | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2948280469281599 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3389579759677872 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3021621649386361 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.297112351981923 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.32233828597236425 | |
built-ruby 0.3171930620446801 | |
built-ruby 0.2824935069074854 | |
built-ruby 0.29181393200997263 | |
built-ruby 0.27976310497615486 | |
built-ruby 0.28373940801247954 | |
----------------------------------------------------------- | |
so_fannkuch | |
# The Computer Language Shootout | |
# http://shootout.alioth.debian.org/ | |
# Contributed by Sokolov Yura | |
# Modified by Ryan Williams | |
def fannkuch(n) | |
maxFlips, m, r, check = 0, n-1, n, 0 | |
count = (1..n).to_a | |
perm = (1..n).to_a | |
while true | |
if check < 30 | |
puts "#{perm}" | |
check += 1 | |
end | |
while r != 1 | |
count[r-1] = r | |
r -= 1 | |
end | |
if perm[0] != 1 and perm[m] != n | |
perml = perm.clone #.dup | |
flips = 0 | |
while (k = perml.first ) != 1 | |
perml = perml.slice!(0, k).reverse + perml | |
flips += 1 | |
end | |
maxFlips = flips if flips > maxFlips | |
end | |
while true | |
if r==n then return maxFlips end | |
perm.insert r,perm.shift | |
break if (count[r] -= 1) > 0 | |
r += 1 | |
end | |
end | |
end | |
def puts *args | |
end | |
N = 9 # (ARGV[0] || 1).to_i | |
puts "Pfannkuchen(#{N}) = #{fannkuch(N)}" | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.195548600051552 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2603375089820474 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.173193629947491 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.230126878945157 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3135004850337282 | |
built-ruby 1.222666513058357 | |
built-ruby 1.1949388809734955 | |
built-ruby 1.188238336937502 | |
built-ruby 1.214579998049885 | |
built-ruby 1.1952616450143978 | |
----------------------------------------------------------- | |
so_fasta | |
# The Computer Language Shootout | |
# http://shootout.alioth.debian.org/ | |
# Contributed by Sokolov Yura | |
$last = 42.0 | |
def gen_random (max,im=139968,ia=3877,ic=29573) | |
(max * ($last = ($last * ia + ic) % im)) / im | |
end | |
alu = | |
"GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG"+ | |
"GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA"+ | |
"CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT"+ | |
"ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA"+ | |
"GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG"+ | |
"AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC"+ | |
"AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA" | |
iub = [ | |
["a", 0.27], | |
["c", 0.12], | |
["g", 0.12], | |
["t", 0.27], | |
["B", 0.02], | |
["D", 0.02], | |
["H", 0.02], | |
["K", 0.02], | |
["M", 0.02], | |
["N", 0.02], | |
["R", 0.02], | |
["S", 0.02], | |
["V", 0.02], | |
["W", 0.02], | |
["Y", 0.02], | |
] | |
homosapiens = [ | |
["a", 0.3029549426680], | |
["c", 0.1979883004921], | |
["g", 0.1975473066391], | |
["t", 0.3015094502008], | |
] | |
def make_repeat_fasta(id, desc, src, n) | |
puts ">#{id} #{desc}" | |
v = nil | |
width = 60 | |
l = src.length | |
s = src * ((n / l) + 1) | |
s.slice!(n, l) | |
puts(s.scan(/.{1,#{width}}/).join("\n")) | |
end | |
def make_random_fasta(id, desc, table, n) | |
puts ">#{id} #{desc}" | |
rand, v = nil,nil | |
width = 60 | |
chunk = 1 * width | |
prob = 0.0 | |
table.each{|v| v[1]= (prob += v[1])} | |
for i in 1..(n/width) | |
puts((1..width).collect{ | |
rand = gen_random(1.0) | |
table.find{|v| v[1]>rand}[0] | |
}.join) | |
end | |
if n%width != 0 | |
puts((1..(n%width)).collect{ | |
rand = gen_random(1.0) | |
table.find{|v| v[1]>rand}[0] | |
}.join) | |
end | |
end | |
n = (ARGV[0] or 250_000).to_i | |
make_repeat_fasta('ONE', 'Homo sapiens alu', alu, n*2) | |
make_random_fasta('TWO', 'IUB ambiguity codes', iub, n*3) | |
make_random_fasta('THREE', 'Homo sapiens frequency', homosapiens, n*5) | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.0799837020458654 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.0712170960614458 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.025488005951047 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.099908426986076 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.051318514975719 | |
built-ruby 1.9957283459370956 | |
built-ruby 1.9421377900289372 | |
built-ruby 1.9475463649723679 | |
built-ruby 1.9905491810059175 | |
built-ruby 1.9425933110760525 | |
----------------------------------------------------------- | |
so_k_nucleotide | |
# The Computer Language Shootout | |
# http://shootout.alioth.debian.org | |
# | |
# contributed by jose fco. gonzalez | |
# modified by Sokolov Yura | |
seq = String.new | |
def frecuency( seq,length ) | |
n, table = seq.length - length + 1, Hash.new(0) | |
f, i = nil, nil | |
(0 ... length).each do |f| | |
(f ... n).step(length) do |i| | |
table[seq[i,length]] += 1 | |
end | |
end | |
[n,table] | |
end | |
def sort_by_freq( seq,length ) | |
n,table = frecuency( seq,length ) | |
a, b, v = nil, nil, nil | |
table.sort{|a,b| b[1] <=> a[1]}.each do |v| | |
puts "%s %.3f" % [v[0].upcase,((v[1]*100).to_f/n)] | |
end | |
puts | |
end | |
def find_seq( seq,s ) | |
n,table = frecuency( seq,s.length ) | |
puts "#{table[s].to_s}\t#{s.upcase}" | |
end | |
input = open(File.join(File.dirname($0), 'fasta.output.100000'), 'rb') | |
line = input.gets while line !~ /^>THREE/ | |
line = input.gets | |
while (line !~ /^>/) & line do | |
seq << line.chomp | |
line = input.gets | |
end | |
[1,2].each {|i| sort_by_freq( seq,i ) } | |
%w(ggt ggta ggtatt ggtattttaatt ggtattttaatttatagt).each{|s| find_seq( seq,s) } | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3331258340040222 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3210365020204335 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2975040499586612 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2961266150232404 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2919675910379738 | |
built-ruby 1.3116200920194387 | |
built-ruby 1.8578620590269566 | |
built-ruby 1.2753536959644407 | |
built-ruby 1.2576407550368458 | |
built-ruby 1.3670301890233532 | |
----------------------------------------------------------- | |
so_lists | |
#from http://www.bagley.org/~doug/shootout/bench/lists/lists.ruby | |
NUM = 300 | |
SIZE = 10000 | |
def test_lists() | |
# create a list of integers (Li1) from 1 to SIZE | |
li1 = (1..SIZE).to_a | |
# copy the list to li2 (not by individual items) | |
li2 = li1.dup | |
# remove each individual item from left side of li2 and | |
# append to right side of li3 (preserving order) | |
li3 = Array.new | |
while (not li2.empty?) | |
li3.push(li2.shift) | |
end | |
# li2 must now be empty | |
# remove each individual item from right side of li3 and | |
# append to right side of li2 (reversing list) | |
while (not li3.empty?) | |
li2.push(li3.pop) | |
end | |
# li3 must now be empty | |
# reverse li1 in place | |
li1.reverse! | |
# check that first item is now SIZE | |
if li1[0] != SIZE then | |
p "not SIZE" | |
0 | |
else | |
# compare li1 and li2 for equality | |
if li1 != li2 then | |
return(0) | |
else | |
# return the length of the list | |
li1.length | |
end | |
end | |
end | |
i = 0 | |
while i<NUM | |
i += 1 | |
result = test_lists() | |
end | |
result | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6434617630438879 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5584338919725269 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6284601120278239 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5885989199159667 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.569430175004527 | |
built-ruby 0.5566898250253871 | |
built-ruby 0.5767613250063732 | |
built-ruby 0.536732375039719 | |
built-ruby 0.5868497409392148 | |
built-ruby 0.5715375680010766 | |
----------------------------------------------------------- | |
so_mandelbrot | |
# The Computer Language Benchmarks Game | |
# http://shootout.alioth.debian.org/ | |
# | |
# contributed by Karl von Laudermann | |
# modified by Jeremy Echols | |
size = 600 # ARGV[0].to_i | |
puts "P4\n#{size} #{size}" | |
ITER = 49 # Iterations - 1 for easy for..in looping | |
LIMIT_SQUARED = 4.0 # Presquared limit | |
byte_acc = 0 | |
bit_num = 0 | |
count_size = size - 1 # Precomputed size for easy for..in looping | |
# For..in loops are faster than .upto, .downto, .times, etc. | |
for y in 0..count_size | |
for x in 0..count_size | |
zr = 0.0 | |
zi = 0.0 | |
cr = (2.0*x/size)-1.5 | |
ci = (2.0*y/size)-1.0 | |
escape = false | |
# To make use of the for..in code, we use a dummy variable, | |
# like one would in C | |
for dummy in 0..ITER | |
tr = zr*zr - zi*zi + cr | |
ti = 2*zr*zi + ci | |
zr, zi = tr, ti | |
if (zr*zr+zi*zi) > LIMIT_SQUARED | |
escape = true | |
break | |
end | |
end | |
byte_acc = (byte_acc << 1) | (escape ? 0b0 : 0b1) | |
bit_num += 1 | |
# Code is very similar for these cases, but using separate blocks | |
# ensures we skip the shifting when it's unnecessary, which is most cases. | |
if (bit_num == 8) | |
print byte_acc.chr | |
byte_acc = 0 | |
bit_num = 0 | |
elsif (x == count_size) | |
byte_acc <<= (8 - bit_num) | |
print byte_acc.chr | |
byte_acc = 0 | |
bit_num = 0 | |
end | |
end | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.6933954290580004 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.719763809000142 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.7030250899260864 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.710448632016778 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.6677420960040763 | |
built-ruby 2.582454991992563 | |
built-ruby 2.630644400953315 | |
built-ruby 2.610673886956647 | |
built-ruby 2.5824020489817485 | |
built-ruby 2.57853459904436 | |
----------------------------------------------------------- | |
so_matrix | |
#!/usr/bin/ruby | |
# -*- mode: ruby -*- | |
# $Id: matrix-ruby.code,v 1.4 2004/11/13 07:42:14 bfulgham Exp $ | |
# http://www.bagley.org/~doug/shootout/ | |
n = 60 #Integer(ARGV.shift || 1) | |
size = 40 | |
def mkmatrix(rows, cols) | |
count = 1 | |
mx = Array.new(rows) | |
(0 .. (rows - 1)).each do |bi| | |
row = Array.new(cols, 0) | |
(0 .. (cols - 1)).each do |j| | |
row[j] = count | |
count += 1 | |
end | |
mx[bi] = row | |
end | |
mx | |
end | |
def mmult(rows, cols, m1, m2) | |
m3 = Array.new(rows) | |
(0 .. (rows - 1)).each do |bi| | |
row = Array.new(cols, 0) | |
(0 .. (cols - 1)).each do |j| | |
val = 0 | |
(0 .. (cols - 1)).each do |k| | |
val += m1.at(bi).at(k) * m2.at(k).at(j) | |
end | |
row[j] = val | |
end | |
m3[bi] = row | |
end | |
m3 | |
end | |
m1 = mkmatrix(size, size) | |
m2 = mkmatrix(size, size) | |
mm = Array.new | |
n.times do | |
mm = mmult(size, size, m1, m2) | |
end | |
# puts "#{mm[0][0]} #{mm[2][3]} #{mm[3][2]} #{mm[4][4]}" | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5532322749495506 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5392589321127161 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5494304629974067 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5443849539151415 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5887995599769056 | |
built-ruby 0.57345147698652 | |
built-ruby 0.548274885979481 | |
built-ruby 0.5917947690468282 | |
built-ruby 0.5585711450548843 | |
built-ruby 0.5582691869931296 | |
----------------------------------------------------------- | |
so_meteor_contest | |
#!/usr/bin/env ruby | |
# | |
# The Computer Language Shootout | |
# http://shootout.alioth.debian.org | |
# contributed by Kevin Barnes (Ruby novice) | |
# PROGRAM: the main body is at the bottom. | |
# 1) read about the problem here: http://www-128.ibm.com/developerworks/java/library/j-javaopt/ | |
# 2) see how I represent a board as a bitmask by reading the blank_board comments | |
# 3) read as your mental paths take you | |
def print *args | |
end | |
# class to represent all information about a particular rotation of a particular piece | |
class Rotation | |
# an array (by location) containing a bit mask for how the piece maps at the given location. | |
# if the rotation is invalid at that location the mask will contain false | |
attr_reader :start_masks | |
# maps a direction to a relative location. these differ depending on whether it is an even or | |
# odd row being mapped from | |
@@rotation_even_adder = { :west => -1, :east => 1, :nw => -7, :ne => -6, :sw => 5, :se => 6 } | |
@@rotation_odd_adder = { :west => -1, :east => 1, :nw => -6, :ne => -5, :sw => 6, :se => 7 } | |
def initialize( directions ) | |
@even_offsets, @odd_offsets = normalize_offsets( get_values( directions )) | |
@even_mask = mask_for_offsets( @even_offsets) | |
@odd_mask = mask_for_offsets( @odd_offsets) | |
@start_masks = Array.new(60) | |
# create the rotational masks by placing the base mask at the location and seeing if | |
# 1) it overlaps the boundaries and 2) it produces a prunable board. if either of these | |
# is true the piece cannot be placed | |
0.upto(59) do | offset | | |
mask = is_even(offset) ? (@even_mask << offset) : (@odd_mask << offset) | |
if (blank_board & mask == 0 && !prunable(blank_board | mask, 0, true)) then | |
imask = compute_required( mask, offset) | |
@start_masks[offset] = [ mask, imask, imask | mask ] | |
else | |
@start_masks[offset] = false | |
end | |
end | |
end | |
def compute_required( mask, offset ) | |
board = blank_board | |
0.upto(offset) { | i | board |= 1 << i } | |
board |= mask | |
return 0 if (!prunable(board | mask, offset)) | |
board = flood_fill(board,58) | |
count = 0 | |
imask = 0 | |
0.upto(59) do | i | | |
if (board[i] == 0) then | |
imask |= (1 << i) | |
count += 1 | |
end | |
end | |
(count > 0 && count < 5) ? imask : 0 | |
end | |
def flood_fill( board, location) | |
return board if (board[location] == 1) | |
board |= 1 << location | |
row, col = location.divmod(6) | |
board = flood_fill( board, location - 1) if (col > 0) | |
board = flood_fill( board, location + 1) if (col < 4) | |
if (row % 2 == 0) then | |
board = flood_fill( board, location - 7) if (col > 0 && row > 0) | |
board = flood_fill( board, location - 6) if (row > 0) | |
board = flood_fill( board, location + 6) if (row < 9) | |
board = flood_fill( board, location + 5) if (col > 0 && row < 9) | |
else | |
board = flood_fill( board, location - 5) if (col < 4 && row > 0) | |
board = flood_fill( board, location - 6) if (row > 0) | |
board = flood_fill( board, location + 6) if (row < 9) | |
board = flood_fill( board, location + 7) if (col < 4 && row < 9) | |
end | |
board | |
end | |
# given a location, produces a list of relative locations covered by the piece at this rotation | |
def offsets( location) | |
if is_even( location) then | |
@even_offsets.collect { | value | value + location } | |
else | |
@odd_offsets.collect { | value | value + location } | |
end | |
end | |
# returns a set of offsets relative to the top-left most piece of the rotation (by even or odd rows) | |
# this is hard to explain. imagine we have this partial board: | |
# 0 0 0 0 0 x [positions 0-5] | |
# 0 0 1 1 0 x [positions 6-11] | |
# 0 0 1 0 0 x [positions 12-17] | |
# 0 1 0 0 0 x [positions 18-23] | |
# 0 1 0 0 0 x [positions 24-29] | |
# 0 0 0 0 0 x [positions 30-35] | |
# ... | |
# The top-left of the piece is at position 8, the | |
# board would be passed as a set of positions (values array) containing [8,9,14,19,25] not necessarily in that | |
# sorted order. Since that array starts on an odd row, the offsets for an odd row are: [0,1,6,11,17] obtained | |
# by subtracting 8 from everything. Now imagine the piece shifted up and to the right so it's on an even row: | |
# 0 0 0 1 1 x [positions 0-5] | |
# 0 0 1 0 0 x [positions 6-11] | |
# 0 0 1 0 0 x [positions 12-17] | |
# 0 1 0 0 0 x [positions 18-23] | |
# 0 0 0 0 0 x [positions 24-29] | |
# 0 0 0 0 0 x [positions 30-35] | |
# ... | |
# Now the positions are [3,4,8,14,19] which after subtracting the lowest value (3) gives [0,1,5,11,16] thus, the | |
# offsets for this particular piece are (in even, odd order) [0,1,5,11,16],[0,1,6,11,17] which is what | |
# this function would return | |
def normalize_offsets( values) | |
min = values.min | |
even_min = is_even(min) | |
other_min = even_min ? min + 6 : min + 7 | |
other_values = values.collect do | value | | |
if is_even(value) then | |
value + 6 - other_min | |
else | |
value + 7 - other_min | |
end | |
end | |
values.collect! { | value | value - min } | |
if even_min then | |
[values, other_values] | |
else | |
[other_values, values] | |
end | |
end | |
# produce a bitmask representation of an array of offset locations | |
def mask_for_offsets( offsets ) | |
mask = 0 | |
offsets.each { | value | mask = mask + ( 1 << value ) } | |
mask | |
end | |
# finds a "safe" position that a position as described by a list of directions can be placed | |
# without falling off any edge of the board. the values returned a location to place the first piece | |
# at so it will fit after making the described moves | |
def start_adjust( directions ) | |
south = east = 0; | |
directions.each do | direction | | |
east += 1 if ( direction == :sw || direction == :nw || direction == :west ) | |
south += 1 if ( direction == :nw || direction == :ne ) | |
end | |
south * 6 + east | |
end | |
# given a set of directions places the piece (as defined by a set of directions) on the board at | |
# a location that will not take it off the edge | |
def get_values ( directions ) | |
start = start_adjust(directions) | |
values = [ start ] | |
directions.each do | direction | | |
if (start % 12 >= 6) then | |
start += @@rotation_odd_adder[direction] | |
else | |
start += @@rotation_even_adder[direction] | |
end | |
values += [ start ] | |
end | |
# some moves take you back to an existing location, we'll strip duplicates | |
values.uniq | |
end | |
end | |
# describes a piece and caches information about its rotations to as to be efficient for iteration | |
# ATTRIBUTES: | |
# rotations -- all the rotations of the piece | |
# type -- a numeic "name" of the piece | |
# masks -- an array by location of all legal rotational masks (a n inner array) for that location | |
# placed -- the mask that this piece was last placed at (not a location, but the actual mask used) | |
class Piece | |
attr_reader :rotations, :type, :masks | |
attr_accessor :placed | |
# transform hashes that change one direction into another when you either flip or rotate a set of directions | |
@@flip_converter = { :west => :west, :east => :east, :nw => :sw, :ne => :se, :sw => :nw, :se => :ne } | |
@@rotate_converter = { :west => :nw, :east => :se, :nw => :ne, :ne => :east, :sw => :west, :se => :sw } | |
def initialize( directions, type ) | |
@type = type | |
@rotations = Array.new(); | |
@map = {} | |
generate_rotations( directions ) | |
directions.collect! { | value | @@flip_converter[value] } | |
generate_rotations( directions ) | |
# creates the masks AND a map that returns [location, rotation] for any given mask | |
# this is used when a board is found and we want to draw it, otherwise the map is unused | |
@masks = Array.new(); | |
0.upto(59) do | i | | |
even = true | |
@masks[i] = @rotations.collect do | rotation | | |
mask = rotation.start_masks[i] | |
@map[mask[0]] = [ i, rotation ] if (mask) | |
mask || nil | |
end | |
@masks[i].compact! | |
end | |
end | |
# rotates a set of directions through all six angles and adds a Rotation to the list for each one | |
def generate_rotations( directions ) | |
6.times do | |
rotations.push( Rotation.new(directions)) | |
directions.collect! { | value | @@rotate_converter[value] } | |
end | |
end | |
# given a board string, adds this piece to the board at whatever location/rotation | |
# important: the outbound board string is 5 wide, the normal location notation is six wide (padded) | |
def fill_string( board_string) | |
location, rotation = @map[@placed] | |
rotation.offsets(location).each do | offset | | |
row, col = offset.divmod(6) | |
board_string[ row*5 + col, 1 ] = @type.to_s | |
end | |
end | |
end | |
# a blank bit board having this form: | |
# | |
# 0 0 0 0 0 1 | |
# 0 0 0 0 0 1 | |
# 0 0 0 0 0 1 | |
# 0 0 0 0 0 1 | |
# 0 0 0 0 0 1 | |
# 0 0 0 0 0 1 | |
# 0 0 0 0 0 1 | |
# 0 0 0 0 0 1 | |
# 0 0 0 0 0 1 | |
# 0 0 0 0 0 1 | |
# 1 1 1 1 1 1 | |
# | |
# where left lest significant bit is the top left and the most significant is the lower right | |
# the actual board only consists of the 0 places, the 1 places are blockers to keep things from running | |
# off the edges or bottom | |
def blank_board | |
0b111111100000100000100000100000100000100000100000100000100000100000 | |
end | |
def full_board | |
0b111111111111111111111111111111111111111111111111111111111111111111 | |
end | |
# determines if a location (bit position) is in an even row | |
def is_even( location) | |
(location % 12) < 6 | |
end | |
# support function that create three utility maps: | |
# $converter -- for each row an array that maps a five bit row (via array mapping) | |
# to the a five bit representation of the bits below it | |
# $bit_count -- maps a five bit row (via array mapping) to the number of 1s in the row | |
# @@new_regions -- maps a five bit row (via array mapping) to an array of "region" arrays | |
# a region array has three values the first is a mask of bits in the region, | |
# the second is the count of those bits and the third is identical to the first | |
# examples: | |
# 0b10010 => [ 0b01100, 2, 0b01100 ], [ 0b00001, 1, 0b00001] | |
# 0b01010 => [ 0b10000, 1, 0b10000 ], [ 0b00100, 1, 0b00100 ], [ 0b00001, 1, 0b00001] | |
# 0b10001 => [ 0b01110, 3, 0b01110 ] | |
def create_collector_support | |
odd_map = [0b11, 0b110, 0b1100, 0b11000, 0b10000] | |
even_map = [0b1, 0b11, 0b110, 0b1100, 0b11000] | |
all_odds = Array.new(0b100000) | |
all_evens = Array.new(0b100000) | |
bit_counts = Array.new(0b100000) | |
new_regions = Array.new(0b100000) | |
0.upto(0b11111) do | i | | |
bit_count = odd = even = 0 | |
0.upto(4) do | bit | | |
if (i[bit] == 1) then | |
bit_count += 1 | |
odd |= odd_map[bit] | |
even |= even_map[bit] | |
end | |
end | |
all_odds[i] = odd | |
all_evens[i] = even | |
bit_counts[i] = bit_count | |
new_regions[i] = create_regions( i) | |
end | |
$converter = [] | |
10.times { | row | $converter.push((row % 2 == 0) ? all_evens : all_odds) } | |
$bit_counts = bit_counts | |
$regions = new_regions.collect { | set | set.collect { | value | [ value, bit_counts[value], value] } } | |
end | |
# determines if a board is punable, meaning that there is no possibility that it | |
# can be filled up with pieces. A board is prunable if there is a grouping of unfilled spaces | |
# that are not a multiple of five. The following board is an example of a prunable board: | |
# 0 0 1 0 0 | |
# 0 1 0 0 0 | |
# 1 1 0 0 0 | |
# 0 1 0 0 0 | |
# 0 0 0 0 0 | |
# ... | |
# | |
# This board is prunable because the top left corner is only 3 bits in area, no piece will ever fit it | |
# parameters: | |
# board -- an initial bit board (6 bit padded rows, see blank_board for format) | |
# location -- starting location, everything above and to the left is already full | |
# slotting -- set to true only when testing initial pieces, when filling normally | |
# additional assumptions are possible | |
# | |
# Algorithm: | |
# The algorithm starts at the top row (as determined by location) and iterates a row at a time | |
# maintainng counts of active open areas (kept in the collector array) each collector contains | |
# three values at the start of an iteration: | |
# 0: mask of bits that would be adjacent to the collector in this row | |
# 1: the number of bits collected so far | |
# 2: a scratch space starting as zero, but used during the computation to represent | |
# the empty bits in the new row that are adjacent (position 0) | |
# The exact procedure is described in-code | |
def prunable( board, location, slotting = false) | |
collectors = [] | |
# loop across the rows | |
(location / 6).to_i.upto(9) do | row_on | | |
# obtain a set of regions representing the bits of the current row. | |
regions = $regions[(board >> (row_on * 6)) & 0b11111] | |
converter = $converter[row_on] | |
# track the number of collectors at the start of the cycle so that | |
# we don't compute against newly created collectors, only existing collectors | |
initial_collector_count = collectors.length | |
# loop against the regions. For each region of the row | |
# we will see if it connects to one or more existing collectors. | |
# if it connects to 1 collector, the bits from the region are added to the | |
# bits of the collector and the mask is placed in collector[2] | |
# If the region overlaps more than one collector then all the collectors | |
# it overlaps with are merged into the first one (the others are set to nil in the array) | |
# if NO collectors are found then the region is copied as a new collector | |
regions.each do | region | | |
collector_found = nil | |
region_mask = region[2] | |
initial_collector_count.times do | collector_num | | |
collector = collectors[collector_num] | |
if (collector) then | |
collector_mask = collector[0] | |
if (collector_mask & region_mask != 0) then | |
if (collector_found) then | |
collector_found[0] |= collector_mask | |
collector_found[1] += collector[1] | |
collector_found[2] |= collector[2] | |
collectors[collector_num] = nil | |
else | |
collector_found = collector | |
collector[1] += region[1] | |
collector[2] |= region_mask | |
end | |
end | |
end | |
end | |
if (collector_found == nil) then | |
collectors.push(Array.new(region)) | |
end | |
end | |
# check the existing collectors, if any collector overlapped no bits in the region its [2] value will | |
# be zero. The size of any such reaason is tested if it is not a multiple of five true is returned since | |
# the board is prunable. if it is a multiple of five it is removed. | |
# Collector that are still active have a new adjacent value [0] set based n the matched bits | |
# and have [2] cleared out for the next cycle. | |
collectors.length.times do | collector_num | | |
collector = collectors[collector_num] | |
if (collector) then | |
if (collector[2] == 0) then | |
return true if (collector[1] % 5 != 0) | |
collectors[collector_num] = nil | |
else | |
# if a collector matches all bits in the row then we can return unprunable early for the | |
# following reasons: | |
# 1) there can be no more unavailable bits bince we fill from the top left downward | |
# 2) all previous regions have been closed or joined so only this region can fail | |
# 3) this region must be good since there can never be only 1 region that is nuot | |
# a multiple of five | |
# this rule only applies when filling normally, so we ignore the rule if we are "slotting" | |
# in pieces to see what configurations work for them (the only other time this algorithm is used). | |
return false if (collector[2] == 0b11111 && !slotting) | |
collector[0] = converter[collector[2]] | |
collector[2] = 0 | |
end | |
end | |
end | |
# get rid of all the empty converters for the next round | |
collectors.compact! | |
end | |
return false if (collectors.length <= 1) # 1 collector or less and the region is fine | |
collectors.any? { | collector | (collector[1] % 5) != 0 } # more than 1 and we test them all for bad size | |
end | |
# creates a region given a row mask. see prunable for what a "region" is | |
def create_regions( value ) | |
regions = [] | |
cur_region = 0 | |
5.times do | bit | | |
if (value[bit] == 0) then | |
cur_region |= 1 << bit | |
else | |
if (cur_region != 0 ) then | |
regions.push( cur_region) | |
cur_region = 0; | |
end | |
end | |
end | |
regions.push(cur_region) if (cur_region != 0) | |
regions | |
end | |
# find up to the counted number of solutions (or all solutions) and prints the final result | |
def find_all | |
find_top( 1) | |
find_top( 0) | |
print_results | |
end | |
# show the board | |
def print_results | |
print "#{@boards_found} solutions found\n\n" | |
print_full_board( @min_board) | |
print "\n" | |
print_full_board( @max_board) | |
print "\n" | |
end | |
# finds solutions. This special version of the main function is only used for the top level | |
# the reason for it is basically to force a particular ordering on how the rotations are tested for | |
# the first piece. It is called twice, first looking for placements of the odd rotations and then | |
# looking for placements of the even locations. | |
# | |
# WHY? | |
# Since any found solution has an inverse we want to maximize finding solutions that are not already found | |
# as an inverse. The inverse will ALWAYS be 3 one of the piece configurations that is exactly 3 rotations away | |
# (an odd number). Checking even vs odd then produces a higher probability of finding more pieces earlier | |
# in the cycle. We still need to keep checking all the permutations, but our probability of finding one will | |
# diminsh over time. Since we are TOLD how many to search for this lets us exit before checking all pieces | |
# this bennifit is very great when seeking small numbers of solutions and is 0 when looking for more than the | |
# maximum number | |
def find_top( rotation_skip) | |
board = blank_board | |
(@pieces.length-1).times do | |
piece = @pieces.shift | |
piece.masks[0].each do | mask, imask, cmask | | |
if ((rotation_skip += 1) % 2 == 0) then | |
piece.placed = mask | |
find( 1, 1, board | mask) | |
end | |
end | |
@pieces.push(piece) | |
end | |
piece = @pieces.shift | |
@pieces.push(piece) | |
end | |
# the normail find routine, iterates through the available pieces, checks all rotations at the current location | |
# and adds any boards found. depth is achieved via recursion. the overall approach is described | |
# here: http://www-128.ibm.com/developerworks/java/library/j-javaopt/ | |
# parameters: | |
# start_location -- where to start looking for place for the next piece at | |
# placed -- number of pieces placed | |
# board -- current state of the board | |
# | |
# see in-code comments | |
def find( start_location, placed, board) | |
# find the next location to place a piece by looking for an empty bit | |
while board[start_location] == 1 | |
start_location += 1 | |
end | |
@pieces.length.times do | |
piece = @pieces.shift | |
piece.masks[start_location].each do | mask, imask, cmask | | |
if ( board & cmask == imask) then | |
piece.placed = mask | |
if (placed == 9) then | |
add_board | |
else | |
find( start_location + 1, placed + 1, board | mask) | |
end | |
end | |
end | |
@pieces.push(piece) | |
end | |
end | |
# print the board | |
def print_full_board( board_string) | |
10.times do | row | | |
print " " if (row % 2 == 1) | |
5.times do | col | | |
print "#{board_string[row*5 + col,1]} " | |
end | |
print "\n" | |
end | |
end | |
# when a board is found we "draw it" into a string and then flip that string, adding both to | |
# the list (hash) of solutions if they are unique. | |
def add_board | |
board_string = "99999999999999999999999999999999999999999999999999" | |
@all_pieces.each { | piece | piece.fill_string( board_string ) } | |
save( board_string) | |
save( board_string.reverse) | |
end | |
# adds a board string to the list (if new) and updates the current best/worst board | |
def save( board_string) | |
if (@all_boards[board_string] == nil) then | |
@min_board = board_string if (board_string < @min_board) | |
@max_board = board_string if (board_string > @max_board) | |
@all_boards.store(board_string,true) | |
@boards_found += 1 | |
# the exit motif is a time saver. Ideally the function should return, but those tests | |
# take noticeable time (performance). | |
if (@boards_found == @stop_count) then | |
print_results | |
exit(0) | |
end | |
end | |
end | |
## | |
## MAIN BODY :) | |
## | |
create_collector_support | |
@pieces = [ | |
Piece.new( [ :nw, :ne, :east, :east ], 2), | |
Piece.new( [ :ne, :se, :east, :ne ], 7), | |
Piece.new( [ :ne, :east, :ne, :nw ], 1), | |
Piece.new( [ :east, :sw, :sw, :se ], 6), | |
Piece.new( [ :east, :ne, :se, :ne ], 5), | |
Piece.new( [ :east, :east, :east, :se ], 0), | |
Piece.new( [ :ne, :nw, :se, :east, :se ], 4), | |
Piece.new( [ :se, :se, :se, :west ], 9), | |
Piece.new( [ :se, :se, :east, :se ], 8), | |
Piece.new( [ :east, :east, :sw, :se ], 3) | |
]; | |
@all_pieces = Array.new( @pieces) | |
@min_board = "99999999999999999999999999999999999999999999999999" | |
@max_board = "00000000000000000000000000000000000000000000000000" | |
@stop_count = ARGV[0].to_i || 2089 | |
@all_boards = {} | |
@boards_found = 0 | |
find_all ######## DO IT!!! | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.214573436998762 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.1098699789727107 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.2271991709712893 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.1673258210066706 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.161870562005788 | |
built-ruby 3.284487602999434 | |
built-ruby 3.1628922530217096 | |
built-ruby 3.23014268593397 | |
built-ruby 3.2681007150094956 | |
built-ruby 3.2358279089676216 | |
----------------------------------------------------------- | |
so_nbody | |
# The Computer Language Shootout | |
# http://shootout.alioth.debian.org | |
# | |
# Optimized for Ruby by Jesse Millikan | |
# From version ported by Michael Neumann from the C gcc version, | |
# which was written by Christoph Bauer. | |
SOLAR_MASS = 4 * Math::PI**2 | |
DAYS_PER_YEAR = 365.24 | |
def _puts *args | |
end | |
class Planet | |
attr_accessor :x, :y, :z, :vx, :vy, :vz, :mass | |
def initialize(x, y, z, vx, vy, vz, mass) | |
@x, @y, @z = x, y, z | |
@vx, @vy, @vz = vx * DAYS_PER_YEAR, vy * DAYS_PER_YEAR, vz * DAYS_PER_YEAR | |
@mass = mass * SOLAR_MASS | |
end | |
def move_from_i(bodies, nbodies, dt, i) | |
while i < nbodies | |
b2 = bodies[i] | |
dx = @x - b2.x | |
dy = @y - b2.y | |
dz = @z - b2.z | |
distance = Math.sqrt(dx * dx + dy * dy + dz * dz) | |
mag = dt / (distance * distance * distance) | |
b_mass_mag, b2_mass_mag = @mass * mag, b2.mass * mag | |
@vx -= dx * b2_mass_mag | |
@vy -= dy * b2_mass_mag | |
@vz -= dz * b2_mass_mag | |
b2.vx += dx * b_mass_mag | |
b2.vy += dy * b_mass_mag | |
b2.vz += dz * b_mass_mag | |
i += 1 | |
end | |
@x += dt * @vx | |
@y += dt * @vy | |
@z += dt * @vz | |
end | |
end | |
def energy(bodies) | |
e = 0.0 | |
nbodies = bodies.size | |
for i in 0 ... nbodies | |
b = bodies[i] | |
e += 0.5 * b.mass * (b.vx * b.vx + b.vy * b.vy + b.vz * b.vz) | |
for j in (i + 1) ... nbodies | |
b2 = bodies[j] | |
dx = b.x - b2.x | |
dy = b.y - b2.y | |
dz = b.z - b2.z | |
distance = Math.sqrt(dx * dx + dy * dy + dz * dz) | |
e -= (b.mass * b2.mass) / distance | |
end | |
end | |
e | |
end | |
def offset_momentum(bodies) | |
px, py, pz = 0.0, 0.0, 0.0 | |
for b in bodies | |
m = b.mass | |
px += b.vx * m | |
py += b.vy * m | |
pz += b.vz * m | |
end | |
b = bodies[0] | |
b.vx = - px / SOLAR_MASS | |
b.vy = - py / SOLAR_MASS | |
b.vz = - pz / SOLAR_MASS | |
end | |
BODIES = [ | |
# sun | |
Planet.new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0), | |
# jupiter | |
Planet.new( | |
4.84143144246472090e+00, | |
-1.16032004402742839e+00, | |
-1.03622044471123109e-01, | |
1.66007664274403694e-03, | |
7.69901118419740425e-03, | |
-6.90460016972063023e-05, | |
9.54791938424326609e-04), | |
# saturn | |
Planet.new( | |
8.34336671824457987e+00, | |
4.12479856412430479e+00, | |
-4.03523417114321381e-01, | |
-2.76742510726862411e-03, | |
4.99852801234917238e-03, | |
2.30417297573763929e-05, | |
2.85885980666130812e-04), | |
# uranus | |
Planet.new( | |
1.28943695621391310e+01, | |
-1.51111514016986312e+01, | |
-2.23307578892655734e-01, | |
2.96460137564761618e-03, | |
2.37847173959480950e-03, | |
-2.96589568540237556e-05, | |
4.36624404335156298e-05), | |
# neptune | |
Planet.new( | |
1.53796971148509165e+01, | |
-2.59193146099879641e+01, | |
1.79258772950371181e-01, | |
2.68067772490389322e-03, | |
1.62824170038242295e-03, | |
-9.51592254519715870e-05, | |
5.15138902046611451e-05) | |
] | |
init = 200_000 # ARGV[0] | |
n = Integer(init) | |
offset_momentum(BODIES) | |
puts "%.9f" % energy(BODIES) | |
nbodies = BODIES.size | |
dt = 0.01 | |
n.times do | |
i = 0 | |
while i < nbodies | |
b = BODIES[i] | |
b.move_from_i(BODIES, nbodies, dt, i + 1) | |
i += 1 | |
end | |
end | |
puts "%.9f" % energy(BODIES) | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4895762570668012 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4316055789822713 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.845774877932854 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.619503965950571 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4358512359904125 | |
built-ruby 1.489605403970927 | |
built-ruby 1.6369827128946781 | |
built-ruby 1.4628069479949772 | |
built-ruby 1.4912516539916396 | |
built-ruby 1.5065212330082431 | |
----------------------------------------------------------- | |
so_nested_loop | |
#!/usr/bin/ruby | |
# -*- mode: ruby -*- | |
# $Id: nestedloop-ruby.code,v 1.4 2004/11/13 07:42:22 bfulgham Exp $ | |
# http://www.bagley.org/~doug/shootout/ | |
# from Avi Bryant | |
n = 16 # Integer(ARGV.shift || 1) | |
x = 0 | |
n.times do | |
n.times do | |
n.times do | |
n.times do | |
n.times do | |
n.times do | |
x += 1 | |
end | |
end | |
end | |
end | |
end | |
end | |
# puts x | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1538302639964968 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1864004079252481 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2282375219510868 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.138558418955654 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.16007225390058 | |
built-ruby 1.185616576927714 | |
built-ruby 1.1600782250752673 | |
built-ruby 1.1420731919351965 | |
built-ruby 1.1650092269992456 | |
built-ruby 1.2048731839749962 | |
----------------------------------------------------------- | |
so_nsieve | |
# The Computer Language Shootout | |
# http://shootout.alioth.debian.org/ | |
# | |
# contributed by Glenn Parker, March 2005 | |
# modified by Evan Phoenix, Sept 2006 | |
def sieve(m) | |
flags = Flags.dup[0,m] | |
count = 0 | |
pmax = m - 1 | |
p = 2 | |
while p <= pmax | |
unless flags[p].zero? | |
count += 1 | |
mult = p | |
while mult <= pmax | |
flags[mult] = 0 | |
mult += p | |
end | |
end | |
p += 1 | |
end | |
count | |
end | |
n = 9 # (ARGV[0] || 2).to_i | |
Flags = ("\x1" * ( 2 ** n * 10_000)).unpack("c*") | |
n.downto(n-2) do |exponent| | |
break if exponent < 0 | |
m = (1 << exponent) * 10_000 | |
# m = (2 ** exponent) * 10_000 | |
count = sieve(m) | |
printf "Primes up to %8d %8d\n", m, count | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.6415367040317506 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.6886816358892247 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.6680605559377 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.6920543529558927 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.782741497969255 | |
built-ruby 2.6169516319641843 | |
built-ruby 3.1001667861128226 | |
built-ruby 2.6669340380467474 | |
built-ruby 2.6808960790513083 | |
built-ruby 2.7213375431019813 | |
----------------------------------------------------------- | |
so_nsieve_bits | |
#!/usr/bin/ruby | |
#coding: us-ascii | |
# | |
# The Great Computer Language Shootout | |
# http://shootout.alioth.debian.org/ | |
# | |
# nsieve-bits in Ruby | |
# Contributed by Glenn Parker, March 2005 | |
CharExponent = 3 | |
BitsPerChar = 1 << CharExponent | |
LowMask = BitsPerChar - 1 | |
def sieve(m) | |
items = "\xFF" * ((m / BitsPerChar) + 1) | |
masks = "" | |
BitsPerChar.times do |b| | |
masks << (1 << b).chr | |
end | |
count = 0 | |
pmax = m - 1 | |
2.step(pmax, 1) do |p| | |
if items[p >> CharExponent][p & LowMask] == 1 | |
count += 1 | |
p.step(pmax, p) do |mult| | |
a = mult >> CharExponent | |
b = mult & LowMask | |
items[a] -= masks[b] if items[a][b] != 0 | |
end | |
end | |
end | |
count | |
end | |
n = 9 # (ARGV[0] || 2).to_i | |
n.step(n - 2, -1) do |exponent| | |
break if exponent < 0 | |
m = 2 ** exponent * 10_000 | |
count = sieve(m) | |
printf "Primes up to %8d %8d\n", m, count | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.301028444082476 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.2683443799614906 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.3539857430150732 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.322234852006659 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.3135949260322377 | |
built-ruby 2.3850281490013003 | |
built-ruby 2.345874104066752 | |
built-ruby 2.378566651022993 | |
built-ruby 2.3643613040912896 | |
built-ruby 2.3432405130006373 | |
----------------------------------------------------------- | |
so_object | |
#!/usr/bin/ruby | |
# -*- mode: ruby -*- | |
# $Id: objinst-ruby.code,v 1.4 2004/11/13 07:42:25 bfulgham Exp $ | |
# http://www.bagley.org/~doug/shootout/ | |
# with help from Aristarkh Zagorodnikov | |
class Toggle | |
def initialize(start_state) | |
@bool = start_state | |
end | |
def value | |
@bool | |
end | |
def activate | |
@bool = !@bool | |
self | |
end | |
end | |
class NthToggle < Toggle | |
def initialize(start_state, max_counter) | |
super start_state | |
@count_max = max_counter | |
@counter = 0 | |
end | |
def activate | |
@counter += 1 | |
if @counter >= @count_max | |
@bool = !@bool | |
@counter = 0 | |
end | |
self | |
end | |
end | |
n = 1500000 # (ARGV.shift || 1).to_i | |
toggle = Toggle.new 1 | |
5.times do | |
toggle.activate.value ? 'true' : 'false' | |
end | |
n.times do | |
toggle = Toggle.new 1 | |
end | |
ntoggle = NthToggle.new 1, 3 | |
8.times do | |
ntoggle.activate.value ? 'true' : 'false' | |
end | |
n.times do | |
ntoggle = NthToggle.new 1, 3 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7316628498956561 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7300474169896916 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7387221120297909 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7108710629399866 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6899573819246143 | |
built-ruby 0.7220470539759845 | |
built-ruby 0.6960933840600774 | |
built-ruby 0.7012202719924971 | |
built-ruby 0.7292858430882916 | |
built-ruby 0.7503255079500377 | |
----------------------------------------------------------- | |
so_partial_sums | |
n = 2_500_000 # (ARGV.shift || 1).to_i | |
alt = 1.0 ; s0 = s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = 0.0 | |
1.upto(n) do |d| | |
d = d.to_f ; d2 = d * d ; d3 = d2 * d ; ds = Math.sin(d) ; dc = Math.cos(d) | |
s0 += (2.0 / 3.0) ** (d - 1.0) | |
s1 += 1.0 / Math.sqrt(d) | |
s2 += 1.0 / (d * (d + 1.0)) | |
s3 += 1.0 / (d3 * ds * ds) | |
s4 += 1.0 / (d3 * dc * dc) | |
s5 += 1.0 / d | |
s6 += 1.0 / d2 | |
s7 += alt / d | |
s8 += alt / (2.0 * d - 1.0) | |
alt = -alt | |
end | |
if false | |
printf("%.9f\t(2/3)^k\n", s0) | |
printf("%.9f\tk^-0.5\n", s1) | |
printf("%.9f\t1/k(k+1)\n", s2) | |
printf("%.9f\tFlint Hills\n", s3) | |
printf("%.9f\tCookson Hills\n", s4) | |
printf("%.9f\tHarmonic\n", s5) | |
printf("%.9f\tRiemann Zeta\n", s6) | |
printf("%.9f\tAlternating Harmonic\n", s7) | |
printf("%.9f\tGregory\n", s8) | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.500978328054771 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.635557516012341 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.560625697951764 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.581163607072085 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.5816292610252276 | |
built-ruby 2.362442729063332 | |
built-ruby 2.4183926139958203 | |
built-ruby 2.3625309329945594 | |
built-ruby 2.341785904020071 | |
built-ruby 2.298863000003621 | |
----------------------------------------------------------- | |
so_pidigits | |
# The Great Computer Language Shootout | |
# http://shootout.alioth.debian.org/ | |
# | |
# contributed by Gabriele Renzi | |
class PiDigitSpigot | |
def initialize() | |
@z = Transformation.new 1,0,0,1 | |
@x = Transformation.new 0,0,0,0 | |
@inverse = Transformation.new 0,0,0,0 | |
end | |
def next! | |
@y = @z.extract(3) | |
if safe? @y | |
@z = produce(@y) | |
@y | |
else | |
@z = consume @x.next!() | |
next!() | |
end | |
end | |
def safe?(digit) | |
digit == @z.extract(4) | |
end | |
def produce(i) | |
@inverse.qrst(10,-10*i,0,1).compose(@z) | |
end | |
def consume(a) | |
@z.compose(a) | |
end | |
end | |
class Transformation | |
attr_reader :q, :r, :s, :t | |
def initialize (q, r, s, t) | |
@q,@r,@s,@t,@k = q,r,s,t,0 | |
end | |
def next!() | |
@q = @k = @k + 1 | |
@r = 4 * @k + 2 | |
@s = 0 | |
@t = 2 * @k + 1 | |
self | |
end | |
def extract(j) | |
(@q * j + @r) / (@s * j + @t) | |
end | |
def compose(a) | |
self.class.new( @q * a.q, | |
@q * a.r + r * a.t, | |
@s * a.q + t * a.s, | |
@s * a.r + t * a.t | |
) | |
end | |
def qrst *args | |
initialize *args | |
self | |
end | |
end | |
WIDTH = 10 | |
n = 2_500 # Integer(ARGV[0]) | |
j = 0 | |
digits = PiDigitSpigot.new | |
while n > 0 | |
if n >= WIDTH | |
WIDTH.times {print digits.next!} | |
j += WIDTH | |
else | |
n.times {print digits.next!} | |
(WIDTH-n).times {print " "} | |
j += n | |
end | |
puts "\t:"+j.to_s | |
n -= WIDTH | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1014664309332147 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.131148666027002 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1265840419800952 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1504818280227482 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0819793560076505 | |
built-ruby 1.122832366032526 | |
built-ruby 1.10261272394564 | |
built-ruby 1.1235766469035298 | |
built-ruby 1.0744329700246453 | |
built-ruby 1.1077712529804558 | |
----------------------------------------------------------- | |
so_random | |
# from http://www.bagley.org/~doug/shootout/bench/random/random.ruby | |
IM = 139968.0 | |
IA = 3877.0 | |
IC = 29573.0 | |
$last = 42.0 | |
def gen_random(max) | |
(max * ($last = ($last * IA + IC) % IM)) / IM | |
end | |
N = 3_000_000 | |
i = 0 | |
while i<N | |
i +=1 | |
gen_random(100.0) | |
end | |
# "%.9f" % gen_random(100.0) | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7285520100267604 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6450352750252932 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6077214890392497 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6734153520083055 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6686573839979246 | |
built-ruby 0.628942308947444 | |
built-ruby 0.6288085500709713 | |
built-ruby 0.5946870530024171 | |
built-ruby 0.6637242790311575 | |
built-ruby 0.6055637079989538 | |
----------------------------------------------------------- | |
so_reverse_complement | |
#!/usr/bin/ruby | |
# The Great Computer Language Shootout | |
# http://shootout.alioth.debian.org/ | |
# | |
# Contributed by Peter Bjarke Olsen | |
# Modified by Doug King | |
seq=Array.new | |
def revcomp(seq) | |
seq.reverse!.tr!('wsatugcyrkmbdhvnATUGCYRKMBDHVN','WSTAACGRYMKVHDBNTAACGRYMKVHDBN') | |
stringlen=seq.length | |
0.step(stringlen-1,60) {|x| print seq.slice(x,60) , "\n"} | |
end | |
input = open(File.join(File.dirname($0), 'fasta.output.2500000'), 'rb') | |
while input.gets | |
if $_ =~ />/ | |
if seq.length != 0 | |
revcomp(seq.join) | |
seq=Array.new | |
end | |
puts $_ | |
else | |
$_.sub(/\n/,'') | |
seq.push $_ | |
end | |
end | |
revcomp(seq.join) | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4943940199445933 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.440265225013718 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.445961530902423 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.435811645933427 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4018389220582321 | |
built-ruby 1.469454557984136 | |
built-ruby 1.4507102069910616 | |
built-ruby 1.4145648250123486 | |
built-ruby 1.455602815025486 | |
built-ruby 1.4465106899151579 | |
----------------------------------------------------------- | |
so_sieve | |
# from http://www.bagley.org/~doug/shootout/bench/sieve/sieve.ruby | |
num = 500 | |
count = i = j = 0 | |
flags0 = Array.new(8192,1) | |
k = 0 | |
while k < num | |
k += 1 | |
count = 0 | |
flags = flags0.dup | |
i = 2 | |
while i<8192 | |
i += 1 | |
if flags[i] | |
# remove all multiples of prime: i | |
j = i*i | |
while j < 8192 | |
j += i | |
flags[j] = nil | |
end | |
count += 1 | |
end | |
end | |
end | |
count | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.660474959993735 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6891729219350964 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6417632529046386 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6398323100293055 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6328638480044901 | |
built-ruby 0.6445695080328733 | |
built-ruby 0.6266142230015248 | |
built-ruby 0.6595635160338134 | |
built-ruby 0.6133787289727479 | |
built-ruby 0.5951220249990001 | |
----------------------------------------------------------- | |
so_spectralnorm | |
# The Computer Language Shootout | |
# http://shootout.alioth.debian.org/ | |
# Contributed by Sokolov Yura | |
def eval_A(i,j) | |
return 1.0/((i+j)*(i+j+1)/2+i+1) | |
end | |
def eval_A_times_u(u) | |
v, i = nil, nil | |
(0..u.length-1).collect { |i| | |
v = 0 | |
for j in 0..u.length-1 | |
v += eval_A(i,j)*u[j] | |
end | |
v | |
} | |
end | |
def eval_At_times_u(u) | |
v, i = nil, nil | |
(0..u.length-1).collect{|i| | |
v = 0 | |
for j in 0..u.length-1 | |
v += eval_A(j,i)*u[j] | |
end | |
v | |
} | |
end | |
def eval_AtA_times_u(u) | |
return eval_At_times_u(eval_A_times_u(u)) | |
end | |
n = 500 # ARGV[0].to_i | |
u=[1]*n | |
for i in 1..10 | |
v=eval_AtA_times_u(u) | |
u=eval_AtA_times_u(v) | |
end | |
vBv=0 | |
vv=0 | |
for i in 0..n-1 | |
vBv += u[i]*v[i] | |
vv += v[i]*v[i] | |
end | |
str = "%0.9f" % (Math.sqrt(vBv/vv)), "\n" | |
# print str | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.059270013938658 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.9691427529323846 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.0123793249949813 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.1967068141093478 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.023914583027363 | |
built-ruby 1.9620243050158024 | |
built-ruby 2.0216803189832717 | |
built-ruby 2.025437308009714 | |
built-ruby 2.004478244925849 | |
built-ruby 1.990443977061659 | |
----------------------------------------------------------- | |
vm1_attr_ivar | |
class C | |
attr_reader :a, :b | |
def initialize | |
@a = nil | |
@b = nil | |
end | |
end | |
obj = C.new | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
j = obj.a | |
k = obj.b | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3876241719117388 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.423093921970576 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4063733690418303 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3726484590442851 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4575823689810932 | |
built-ruby 1.4028229980031028 | |
built-ruby 1.3671701760031283 | |
built-ruby 1.3549646720057353 | |
built-ruby 1.3731246680254117 | |
built-ruby 1.3669164490420371 | |
----------------------------------------------------------- | |
vm1_attr_ivar_set | |
class C | |
attr_accessor :a, :b | |
def initialize | |
@a = nil | |
@b = nil | |
end | |
end | |
obj = C.new | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
obj.a = 1 | |
obj.b = 2 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.5688812079606578 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.5478982600616291 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.5380625020479783 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.5633647539652884 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.620823297998868 | |
built-ruby 1.5418967349687591 | |
built-ruby 1.48236778692808 | |
built-ruby 1.5228633630322292 | |
built-ruby 1.5233477290021256 | |
built-ruby 1.5486485019791871 | |
----------------------------------------------------------- | |
vm1_block | |
def m | |
yield | |
end | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
m{ | |
} | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.246818611980416 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.2079854790354148 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.213123625027947 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.2354054159950465 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.1953787250677124 | |
built-ruby 2.201612767064944 | |
built-ruby 2.523623585002497 | |
built-ruby 2.1377351749688387 | |
built-ruby 2.0588061809539795 | |
built-ruby 2.1557904719375074 | |
----------------------------------------------------------- | |
vm1_const | |
Const = 1 | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
j = Const | |
k = Const | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0557627399684861 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0482352750841528 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9834175130818039 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.013727328972891 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0749761029146612 | |
built-ruby 1.0029777029994875 | |
built-ruby 1.006267064018175 | |
built-ruby 0.958953044959344 | |
built-ruby 0.9535192149924114 | |
built-ruby 0.9709162269718945 | |
----------------------------------------------------------- | |
vm1_ensure | |
i = 0 | |
while i<30_000_000 # benchmark loop 1 | |
i += 1 | |
begin | |
begin | |
ensure | |
end | |
ensure | |
end | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6617931340588257 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.677746835979633 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6652506350073963 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.674703765893355 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7130720471031964 | |
built-ruby 0.6786994088906795 | |
built-ruby 0.6699052449548617 | |
built-ruby 0.6772454179590568 | |
built-ruby 0.6550830299966037 | |
built-ruby 0.6925848430255428 | |
----------------------------------------------------------- | |
vm1_float_simple | |
i = 0.0; f = 0.0 | |
while i<30_000_000 | |
i += 1 | |
f += 0.1; f -= 0.1 | |
f += 0.1; f -= 0.1 | |
f += 0.1; f -= 0.1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.074818579014391 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.165055634919554 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.035747924004681 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.166535242926329 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.092950901016593 | |
built-ruby 4.838305815006606 | |
built-ruby 4.97397249401547 | |
built-ruby 4.876350463018753 | |
built-ruby 4.890076918061823 | |
built-ruby 5.272137445979752 | |
----------------------------------------------------------- | |
vm1_gc_short_lived | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
a = '' # short-lived String | |
b = '' | |
c = '' | |
d = '' | |
e = '' | |
f = '' | |
i+=1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.572701918077655 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.545986801967956 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.000963474041782 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.556481067091227 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.485821065958589 | |
built-ruby 5.838013182044961 | |
built-ruby 5.816040721023455 | |
built-ruby 5.821146882022731 | |
built-ruby 5.810023466008715 | |
built-ruby 5.772213945980184 | |
----------------------------------------------------------- | |
vm1_gc_short_with_complex_long | |
def nested_hash h, n | |
if n == 0 | |
'' | |
else | |
10.times{ | |
h[Object.new] = nested_hash(h, n-1) | |
} | |
end | |
end | |
long_lived = Hash.new | |
nested_hash long_lived, 6 | |
GC.start | |
GC.start | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
a = '' # short-lived String | |
b = '' | |
c = '' | |
d = '' | |
e = '' | |
f = '' | |
i+=1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.944078120985068 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.91458666708786 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.887309234007262 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.812018226017244 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.778544000000693 | |
built-ruby 6.990529346978292 | |
built-ruby 7.437959754955955 | |
built-ruby 7.150567961973138 | |
built-ruby 7.282231591991149 | |
built-ruby 6.9792400759179145 | |
----------------------------------------------------------- | |
vm1_gc_short_with_long | |
long_lived = Array.new(1_000_000){|i| "#{i}"} | |
GC.start | |
GC.start | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
a = '' # short-lived String | |
b = '' | |
c = '' | |
d = '' | |
e = '' | |
f = '' | |
i+=1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 7.850343853002414 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 7.762539469986223 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.861532868002541 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 7.878978183027357 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 7.914530333015136 | |
built-ruby 7.6992403760086745 | |
built-ruby 7.291564689017832 | |
built-ruby 7.528386167017743 | |
built-ruby 7.521672914037481 | |
built-ruby 7.850672955042683 | |
----------------------------------------------------------- | |
vm1_gc_short_with_symbol | |
# make many symbols | |
50_000.times{|i| sym = "sym#{i}".to_sym} | |
GC.start | |
GC.start | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
a = '' # short-lived String | |
b = '' | |
c = '' | |
d = '' | |
e = '' | |
f = '' | |
i+=1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.418937964946963 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.385293962084688 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.367769657052122 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.473877201904543 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.48634485702496 | |
built-ruby 5.690719706937671 | |
built-ruby 5.643763103988022 | |
built-ruby 5.633787351078354 | |
built-ruby 5.613751008058898 | |
built-ruby 5.717727579060011 | |
----------------------------------------------------------- | |
vm1_gc_wb_ary | |
short_lived_ary = [] | |
if RUBY_VERSION >= "2.2.0" | |
GC.start(full_mark: false, immediate_mark: true, lazy_sweep: false) | |
end | |
i = 0 | |
short_lived = '' | |
while i<30_000_000 # while loop 1 | |
short_lived_ary[0] = short_lived # write barrier | |
i+=1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4957145610824227 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3121602110331878 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3108665400650352 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3237949339672923 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.380240107071586 | |
built-ruby 1.2927148959133774 | |
built-ruby 1.334393939934671 | |
built-ruby 1.326941855950281 | |
built-ruby 1.2956522499443963 | |
built-ruby 1.3605772809823975 | |
----------------------------------------------------------- | |
vm1_gc_wb_ary_promoted | |
long_lived = [] | |
if RUBY_VERSION > "2.2.0" | |
3.times{ GC.start(full_mark: false, immediate_mark: true, lazy_sweep: false) } | |
elsif | |
GC.start | |
end | |
i = 0 | |
short_lived = '' | |
while i<30_000_000 # while loop 1 | |
long_lived[0] = short_lived # write barrier | |
i+=1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3682217249879614 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3558116810163483 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.360071693896316 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3655561860650778 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3565650300588459 | |
built-ruby 1.3655343720456585 | |
built-ruby 1.3614942979766056 | |
built-ruby 1.3698562079807743 | |
built-ruby 1.354985506972298 | |
built-ruby 1.3573237539967522 | |
----------------------------------------------------------- | |
vm1_gc_wb_obj | |
class C | |
attr_accessor :foo | |
end | |
short_lived_obj = C.new | |
if RUBY_VERSION >= "2.2.0" | |
GC.start(full_mark: false, immediate_mark: true, lazy_sweep: false) | |
end | |
i = 0 | |
short_lived = '' | |
while i<30_000_000 # while loop 1 | |
short_lived_obj.foo = short_lived # write barrier | |
i+=1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0992813609773293 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1019161560107023 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1150748250074685 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1471848729997873 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.16383711702656 | |
built-ruby 1.183711896999739 | |
built-ruby 1.2077994539868087 | |
built-ruby 1.1470503279706463 | |
built-ruby 1.1518515850184485 | |
built-ruby 1.1603614799678326 | |
----------------------------------------------------------- | |
vm1_gc_wb_obj_promoted | |
class C | |
attr_accessor :foo | |
end | |
long_lived = C.new | |
if RUBY_VERSION >= "2.2.0" | |
3.times{ GC.start(full_mark: false, immediate_mark: true, lazy_sweep: false) } | |
elsif | |
GC.start | |
end | |
i = 0 | |
short_lived = '' | |
while i<30_000_000 # while loop 1 | |
long_lived.foo = short_lived # write barrier | |
i+=1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.142343875952065 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.21332610596437 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2029662259155884 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1734894380206242 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2440429279813543 | |
built-ruby 1.1906692289048806 | |
built-ruby 1.147119683912024 | |
built-ruby 1.2236301820958033 | |
built-ruby 1.2194672190817073 | |
built-ruby 1.1963192019611597 | |
----------------------------------------------------------- | |
vm1_ivar | |
@a = 1 | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
j = @a | |
k = @a | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9659482229035348 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9386006289860234 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0074852700345218 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9076412020949647 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.006104167085141 | |
built-ruby 0.9365795280318707 | |
built-ruby 0.933955890010111 | |
built-ruby 0.9595873641083017 | |
built-ruby 0.9222068400122225 | |
built-ruby 0.9303905110573396 | |
----------------------------------------------------------- | |
vm1_ivar_set | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
@a = 1 | |
@b = 2 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0100207289215177 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9490665280027315 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.940879620029591 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9348470020340756 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0969619620591402 | |
built-ruby 0.9733142430195585 | |
built-ruby 0.9965538509422913 | |
built-ruby 0.9328566050389782 | |
built-ruby 0.9386856540804729 | |
built-ruby 0.9445662290090695 | |
----------------------------------------------------------- | |
vm1_length | |
a = 'abc' | |
b = [1, 2, 3] | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
a.length | |
b.length | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2175306610297412 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2118691129144281 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.244486027979292 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.170522646047175 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1583953999215737 | |
built-ruby 1.2801110820146278 | |
built-ruby 1.1823380690766498 | |
built-ruby 1.2047874119598418 | |
built-ruby 1.1686808429658413 | |
built-ruby 1.1911647350061685 | |
----------------------------------------------------------- | |
vm1_lvar_init | |
def m v | |
unless v | |
# unreachable code | |
v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = v9 = v10 = | |
v11 = v12 = v13 = v14 = v15 = v16 = v17 = v18 = v19 = v20 = | |
v21 = v22 = v23 = v24 = v25 = v26 = v27 = v28 = v29 = v30 = | |
v31 = v32 = v33 = v34 = v35 = v36 = v37 = v38 = v39 = v40 = | |
v41 = v42 = v43 = v44 = v45 = v46 = v47 = v48 = v49 = v50 = 1 | |
end | |
end | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
m i | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.1999385319650173 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.2071183719672263 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.3052751310169697 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.4191457720007747 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.3370251399464905 | |
built-ruby 2.039467212976888 | |
built-ruby 2.2144007469760254 | |
built-ruby 1.9835393260000274 | |
built-ruby 2.0068190899910405 | |
built-ruby 2.164110332960263 | |
----------------------------------------------------------- | |
vm1_lvar_set | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
a = b = c = d = e = f = g = h = j = k = l = m = n = o = p = q = r = 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.256971818045713 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.2059226050041616 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.2343228210229427 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.2001832550158724 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.2589813239173964 | |
built-ruby 3.1277232139836997 | |
built-ruby 3.1559996819123626 | |
built-ruby 3.183988763950765 | |
built-ruby 3.1363863369915634 | |
built-ruby 3.053303731023334 | |
----------------------------------------------------------- | |
vm1_neq | |
i = 0 | |
obj1 = Object.new | |
obj2 = Object.new | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
obj1 != obj2 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2878046439727768 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3137129640672356 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3088577809976414 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.292765369056724 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2345328869996592 | |
built-ruby 1.2941599630285054 | |
built-ruby 1.2622110019437969 | |
built-ruby 1.2626920159673318 | |
built-ruby 1.3932315480196849 | |
built-ruby 1.313475435017608 | |
----------------------------------------------------------- | |
vm1_not | |
i = 0 | |
obj = Object.new | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
!obj | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0429368420736864 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.022667674929835 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0024491749936715 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0336345180403441 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.018504393985495 | |
built-ruby 1.0037973059806973 | |
built-ruby 0.9977195999817923 | |
built-ruby 0.9823493961011991 | |
built-ruby 0.9571478849975392 | |
built-ruby 1.0139474710449576 | |
----------------------------------------------------------- | |
vm1_rescue | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
begin | |
rescue | |
end | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8484178560320288 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8812193790217862 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8280623060418293 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8443494009552523 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8195043129380792 | |
built-ruby 0.7790486529702321 | |
built-ruby 0.7816934599541128 | |
built-ruby 0.7920452429680154 | |
built-ruby 0.8032334269955754 | |
built-ruby 0.8415183509932831 | |
----------------------------------------------------------- | |
vm1_simplereturn | |
def m | |
return 1 | |
end | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
m | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4098546450259164 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4011824259068817 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3476103310240433 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4199581819120795 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3929492770694196 | |
built-ruby 1.291701184003614 | |
built-ruby 1.3379355550277978 | |
built-ruby 1.3694995699916035 | |
built-ruby 1.3547811899334192 | |
built-ruby 1.3476812770823017 | |
----------------------------------------------------------- | |
vm1_swap | |
a = 1 | |
b = 2 | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
a, b = b, a | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9882256770506501 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9617749890312552 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9844363369047642 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9844670949969441 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9851212380453944 | |
built-ruby 0.9672923469915986 | |
built-ruby 0.9713920570211485 | |
built-ruby 0.9688850929960608 | |
built-ruby 0.961939447093755 | |
built-ruby 0.945147947059013 | |
----------------------------------------------------------- | |
vm1_yield | |
def m | |
i = 0 | |
while i<30_000_000 # while loop 1 | |
i += 1 | |
yield | |
end | |
end | |
m{} | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.5301956719486043 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.5524513619020581 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.535960379987955 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.5487538470188156 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.532978364964947 | |
built-ruby 1.3853197180433199 | |
built-ruby 1.3767576909158379 | |
built-ruby 1.45196552190464 | |
built-ruby 1.3847791280131787 | |
built-ruby 1.3985177259892225 | |
----------------------------------------------------------- | |
vm2_array | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
a = [1,2,3,4,5,6,7,8,9,10] | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9864808169659227 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9424049269873649 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9470406629843637 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.947011454962194 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9521666320506483 | |
built-ruby 0.9340404389658943 | |
built-ruby 0.9500445630401373 | |
built-ruby 0.8731430990155786 | |
built-ruby 0.9165771009866148 | |
built-ruby 0.8695507129887119 | |
----------------------------------------------------------- | |
vm2_bigarray | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
a = [ | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
1,2,3,4,5,6,7,8,9,10, | |
] | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 10.2267295520287 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 9.561489130021073 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 10.090644246898592 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 10.081709917983972 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 10.075742300017737 | |
built-ruby 9.472753201960586 | |
built-ruby 9.467810433008708 | |
built-ruby 9.441162261995487 | |
built-ruby 9.294025932089426 | |
built-ruby 9.455035869963467 | |
----------------------------------------------------------- | |
vm2_bighash | |
i = 0 | |
while i<60_000 # benchmark loop 2 | |
i += 1 | |
a = {0=>0, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, 6=>6, 7=>7, 8=>8, 9=>9, 10=>10, 11=>11, 12=>12, 13=>13, 14=>14, 15=>15, 16=>16, 17=>17, 18=>18, 19=>19, 20=>20, 21=>21, 22=>22, 23=>23, 24=>24, 25=>25, 26=>26, 27=>27, 28=>28, 29=>29, 30=>30, 31=>31, 32=>32, 33=>33, 34=>34, 35=>35, 36=>36, 37=>37, 38=>38, 39=>39, 40=>40, 41=>41, 42=>42, 43=>43, 44=>44, 45=>45, 46=>46, 47=>47, 48=>48, 49=>49, 50=>50, 51=>51, 52=>52, 53=>53, 54=>54, 55=>55, 56=>56, 57=>57, 58=>58, 59=>59, 60=>60, 61=>61, 62=>62, 63=>63, 64=>64, 65=>65, 66=>66, 67=>67, 68=>68, 69=>69, 70=>70, 71=>71, 72=>72, 73=>73, 74=>74, 75=>75, 76=>76, 77=>77, 78=>78, 79=>79, 80=>80, 81=>81, 82=>82, 83=>83, 84=>84, 85=>85, 86=>86, 87=>87, 88=>88, 89=>89, 90=>90, 91=>91, 92=>92, 93=>93, 94=>94, 95=>95, 96=>96, 97=>97, 98=>98, 99=>99, 100=>100, 101=>101, 102=>102, 103=>103, 104=>104, 105=>105, 106=>106, 107=>107, 108=>108, 109=>109, 110=>110, 111=>111, 112=>112, 113=>113, 114=>114, 115=>115, 116=>116, 117=>117, 118=>118, 119=>119, 120=>120, 121=>121, 122=>122, 123=>123, 124=>124, 125=>125, 126=>126, 127=>127, 128=>128, 129=>129, 130=>130, 131=>131, 132=>132, 133=>133, 134=>134, 135=>135, 136=>136, 137=>137, 138=>138, 139=>139, 140=>140, 141=>141, 142=>142, 143=>143, 144=>144, 145=>145, 146=>146, 147=>147, 148=>148, 149=>149, 150=>150, 151=>151, 152=>152, 153=>153, 154=>154, 155=>155, 156=>156, 157=>157, 158=>158, 159=>159, 160=>160, 161=>161, 162=>162, 163=>163, 164=>164, 165=>165, 166=>166, 167=>167, 168=>168, 169=>169, 170=>170, 171=>171, 172=>172, 173=>173, 174=>174, 175=>175, 176=>176, 177=>177, 178=>178, 179=>179, 180=>180, 181=>181, 182=>182, 183=>183, 184=>184, 185=>185, 186=>186, 187=>187, 188=>188, 189=>189, 190=>190, 191=>191, 192=>192, 193=>193, 194=>194, 195=>195, 196=>196, 197=>197, 198=>198, 199=>199, 200=>200, 201=>201, 202=>202, 203=>203, 204=>204, 205=>205, 206=>206, 207=>207, 208=>208, 209=>209, 210=>210, 211=>211, 212=>212, 213=>213, 214=>214, 215=>215, 216=>216, 217=>217, 218=>218, 219=>219, 220=>220, 221=>221, 222=>222, 223=>223, 224=>224, 225=>225, 226=>226, 227=>227, 228=>228, 229=>229, 230=>230, 231=>231, 232=>232, 233=>233, 234=>234, 235=>235, 236=>236, 237=>237, 238=>238, 239=>239, 240=>240, 241=>241, 242=>242, 243=>243, 244=>244, 245=>245, 246=>246, 247=>247, 248=>248, 249=>249, 250=>250, 251=>251, 252=>252, 253=>253, 254=>254, 255=>255, 256=>256, 257=>257, 258=>258, 259=>259, 260=>260, 261=>261, 262=>262, 263=>263, 264=>264, 265=>265, 266=>266, 267=>267, 268=>268, 269=>269, 270=>270, 271=>271, 272=>272, 273=>273, 274=>274, 275=>275, 276=>276, 277=>277, 278=>278, 279=>279, 280=>280, 281=>281, 282=>282, 283=>283, 284=>284, 285=>285, 286=>286, 287=>287, 288=>288, 289=>289, 290=>290, 291=>291, 292=>292, 293=>293, 294=>294, 295=>295, 296=>296, 297=>297, 298=>298, 299=>299, 300=>300, 301=>301, 302=>302, 303=>303, 304=>304, 305=>305, 306=>306, 307=>307, 308=>308, 309=>309, 310=>310, 311=>311, 312=>312, 313=>313, 314=>314, 315=>315, 316=>316, 317=>317, 318=>318, 319=>319, 320=>320, 321=>321, 322=>322, 323=>323, 324=>324, 325=>325, 326=>326, 327=>327, 328=>328, 329=>329, 330=>330, 331=>331, 332=>332, 333=>333, 334=>334, 335=>335, 336=>336, 337=>337, 338=>338, 339=>339, 340=>340, 341=>341, 342=>342, 343=>343, 344=>344, 345=>345, 346=>346, 347=>347, 348=>348, 349=>349, 350=>350, 351=>351, 352=>352, 353=>353, 354=>354, 355=>355, 356=>356, 357=>357, 358=>358, 359=>359, 360=>360, 361=>361, 362=>362, 363=>363, 364=>364, 365=>365, 366=>366, 367=>367, 368=>368, 369=>369, 370=>370, 371=>371, 372=>372, 373=>373, 374=>374, 375=>375, 376=>376, 377=>377, 378=>378, 379=>379, 380=>380, 381=>381, 382=>382, 383=>383, 384=>384, 385=>385, 386=>386, 387=>387, 388=>388, 389=>389, 390=>390, 391=>391, 392=>392, 393=>393, 394=>394, 395=>395, 396=>396, 397=>397, 398=>398, 399=>399, 400=>400, 401=>401, 402=>402, 403=>403, 404=>404, 405=>405, 406=>406, 407=>407, 408=>408, 409=>409, 410=>410, 411=>411, 412=>412, 413=>413, 414=>414, 415=>415, 416=>416, 417=>417, 418=>418, 419=>419, 420=>420, 421=>421, 422=>422, 423=>423, 424=>424, 425=>425, 426=>426, 427=>427, 428=>428, 429=>429, 430=>430, 431=>431, 432=>432, 433=>433, 434=>434, 435=>435, 436=>436, 437=>437, 438=>438, 439=>439, 440=>440, 441=>441, 442=>442, 443=>443, 444=>444, 445=>445, 446=>446, 447=>447, 448=>448, 449=>449, 450=>450, 451=>451, 452=>452, 453=>453, 454=>454, 455=>455, 456=>456, 457=>457, 458=>458, 459=>459, 460=>460, 461=>461, 462=>462, 463=>463, 464=>464, 465=>465, 466=>466, 467=>467, 468=>468, 469=>469, 470=>470, 471=>471, 472=>472, 473=>473, 474=>474, 475=>475, 476=>476, 477=>477, 478=>478, 479=>479, 480=>480, 481=>481, 482=>482, 483=>483, 484=>484, 485=>485, 486=>486, 487=>487, 488=>488, 489=>489, 490=>490, 491=>491, 492=>492, 493=>493, 494=>494, 495=>495, 496=>496, 497=>497, 498=>498, 499=>499, 500=>500,} | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.359866971964948 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.196486475062557 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.278961407020688 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.328070296091028 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.210509800934233 | |
built-ruby 4.050221433979459 | |
built-ruby 4.044077206985094 | |
built-ruby 4.032773734070361 | |
built-ruby 4.100809400086291 | |
built-ruby 4.102739860070869 | |
----------------------------------------------------------- | |
vm2_case | |
i = 0 | |
while i<6_000_000 # while loop 2 | |
case :foo | |
when :bar | |
raise | |
when :baz | |
raise | |
when :boo | |
raise | |
when :foo | |
i += 1 | |
end | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2619465009775013 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2838237399701029 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.28194263100158423 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.26048463792540133 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2488515069708228 | |
built-ruby 0.22200593899469823 | |
built-ruby 0.24976177606731653 | |
built-ruby 0.23845415096729994 | |
built-ruby 0.2544713739771396 | |
built-ruby 0.23091391392517835 | |
----------------------------------------------------------- | |
vm2_case_lit | |
i = 0 | |
@ret = [ "foo", true, false, :sym, 6, nil, 0.1, 0xffffffffffffffff ] | |
def foo(i) | |
@ret[i % @ret.size] | |
end | |
while i<6_000_000 # while loop 2 | |
case foo(i) | |
when "foo" then :foo | |
when true then true | |
when false then false | |
when :sym then :sym | |
when 6 then :fix | |
when nil then nil | |
when 0.1 then :float | |
when 0xffffffffffffffff then :big | |
end | |
i += 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8754943540552631 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9623493229737505 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8772008740343153 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8502874290570617 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.878177392994985 | |
built-ruby 0.8820248820120469 | |
built-ruby 0.8694034670479596 | |
built-ruby 0.8623934079660103 | |
built-ruby 0.8866133840056136 | |
built-ruby 0.9067962359404191 | |
----------------------------------------------------------- | |
vm2_defined_method | |
class Object | |
define_method(:m){} | |
end | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
m; m; m; m; m; m; m; m; | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.0769560820190236 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.94910455995705 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.9971248959191144 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.9844176850747317 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.0369281029561535 | |
built-ruby 3.5950162559747696 | |
built-ruby 3.530674858018756 | |
built-ruby 3.5434669690439478 | |
built-ruby 3.660136030986905 | |
built-ruby 3.555109731038101 | |
----------------------------------------------------------- | |
vm2_dstr | |
i = 0 | |
x = y = 'z' | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
str = "foo#{x}bar#{y}baz" | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1376889569219202 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1790524049429223 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1705649680225179 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1717189019545913 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.178114204085432 | |
built-ruby 1.194065082934685 | |
built-ruby 1.1828249279642478 | |
built-ruby 1.1808544259984046 | |
built-ruby 1.2567875509848818 | |
built-ruby 1.3292802079813555 | |
----------------------------------------------------------- | |
vm2_eval | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
eval("1") | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 22.748127643950284 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 22.279592863982543 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 22.21301919000689 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 23.91950308997184 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 22.592453115037642 | |
built-ruby 22.470529740909114 | |
built-ruby 22.542434667004272 | |
built-ruby 22.369654320064 | |
built-ruby 22.324487831094302 | |
built-ruby 22.234362442977726 | |
----------------------------------------------------------- | |
vm2_method | |
def m | |
nil | |
end | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
m; m; m; m; m; m; m; m; | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.279581852024421 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2871431020321324 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2596520120278 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3235943879699335 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4536260040476918 | |
built-ruby 1.2885518729453906 | |
built-ruby 1.2857341149356216 | |
built-ruby 1.3142342009814456 | |
built-ruby 1.2660287170438096 | |
built-ruby 1.2564591499976814 | |
----------------------------------------------------------- | |
vm2_method_missing | |
class C | |
def method_missing mid | |
end | |
end | |
obj = C.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
obj.m; obj.m; obj.m; obj.m; obj.m; obj.m; obj.m; obj.m; | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.8666849200380966 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.909256412065588 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.7894520999398082 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.8363070489140227 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.8184968259884045 | |
built-ruby 2.852661070995964 | |
built-ruby 2.917175633017905 | |
built-ruby 3.059407752007246 | |
built-ruby 2.8628767759073526 | |
built-ruby 2.897778737009503 | |
----------------------------------------------------------- | |
vm2_method_with_block | |
def m | |
nil | |
end | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
m{}; m{}; m{}; m{}; m{}; m{}; m{}; m{}; | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3699430170236155 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.38195694796741 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3769991729641333 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.364738714066334 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3902382090454921 | |
built-ruby 1.4707032139413059 | |
built-ruby 1.3853221370372921 | |
built-ruby 1.4449089680565521 | |
built-ruby 1.3887808859581128 | |
built-ruby 1.398828632896766 | |
----------------------------------------------------------- | |
vm2_mutex | |
require 'thread' | |
m = Thread::Mutex.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
m.synchronize{} | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8668883019126952 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8786476789973676 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8934233809122816 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8874565199948847 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.8399143670685589 | |
built-ruby 0.9818649550434202 | |
built-ruby 0.8836689819581807 | |
built-ruby 0.9677371230209246 | |
built-ruby 0.988495300989598 | |
built-ruby 0.9366747270105407 | |
----------------------------------------------------------- | |
vm2_newlambda | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
lambda {} | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.9959138419944793 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0006342570995912 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0061358049279079 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1668292969698086 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0103186609921977 | |
built-ruby 0.9846504109445959 | |
built-ruby 1.0045254629803821 | |
built-ruby 1.029782057972625 | |
built-ruby 1.0084058369975537 | |
built-ruby 0.9647894209483638 | |
----------------------------------------------------------- | |
vm2_poly_method | |
class C1 | |
def m | |
1 | |
end | |
end | |
class C2 | |
def m | |
2 | |
end | |
end | |
o1 = C1.new | |
o2 = C2.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
o = (i % 2 == 0) ? o1 : o2 | |
o.m; o.m; o.m; o.m; o.m; o.m; o.m; o.m | |
i += 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.0255783010507002 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.019156118039973 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.0477078839903697 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.976079158950597 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.0265013909665868 | |
built-ruby 3.110283198999241 | |
built-ruby 3.346966362092644 | |
built-ruby 3.1246633320115507 | |
built-ruby 3.189704268006608 | |
built-ruby 3.2260494510410354 | |
----------------------------------------------------------- | |
vm2_poly_method_ov | |
class C1 | |
def m | |
1 | |
end | |
end | |
class C2 | |
def m | |
2 | |
end | |
end | |
o1 = C1.new | |
o2 = C2.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
o = (i % 2 == 0) ? o1 : o2 | |
# o.m; o.m; o.m; o.m; o.m; o.m; o.m; o.m | |
i += 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.37027859897352755 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.35654415807221085 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.34592776000499725 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3836190359434113 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.38584208802785724 | |
built-ruby 0.3884468119358644 | |
built-ruby 0.383586265030317 | |
built-ruby 0.3898650569608435 | |
built-ruby 0.3500508249271661 | |
built-ruby 0.4463722149375826 | |
----------------------------------------------------------- | |
vm2_proc | |
def m &b | |
b | |
end | |
pr = m{ | |
a = 1 | |
} | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
pr.call | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6089216130785644 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6150774590205401 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5714327949099243 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5753663349896669 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.605134749901481 | |
built-ruby 0.6111840310040861 | |
built-ruby 0.6757885330589488 | |
built-ruby 0.8651169380173087 | |
built-ruby 0.6847723949467763 | |
built-ruby 0.7148988990811631 | |
----------------------------------------------------------- | |
vm2_raise1 | |
def rec n | |
if n > 0 | |
rec n-1 | |
else | |
raise | |
end | |
end | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
begin | |
rec 1 | |
rescue | |
# ignore | |
end | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.949372387956828 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.930352870025672 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.002072151983157 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.15390663407743 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.110922234016471 | |
built-ruby 4.8909971109824255 | |
built-ruby 5.349751180969179 | |
built-ruby 4.857086256030016 | |
built-ruby 4.896873041987419 | |
built-ruby 4.865523607004434 | |
----------------------------------------------------------- | |
vm2_raise2 | |
def rec n | |
if n > 0 | |
rec n-1 | |
else | |
raise | |
end | |
end | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
begin | |
rec 10 | |
rescue | |
# ignore | |
end | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 7.961383535992354 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 7.700990153010935 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 7.693204144947231 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 7.590272767934948 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 8.095175190013833 | |
built-ruby 8.365565062966198 | |
built-ruby 7.621092822984792 | |
built-ruby 7.537460542982444 | |
built-ruby 7.515401293989271 | |
built-ruby 7.818980882992037 | |
----------------------------------------------------------- | |
vm2_regexp | |
i = 0 | |
str = 'xxxhogexxx' | |
while i<6_000_000 # benchmark loop 2 | |
/hoge/ =~ str | |
i += 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.313094164012 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3076641110237688 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.284106100909412 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.2731323440093547 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.3697610169183463 | |
built-ruby 1.3594907260267064 | |
built-ruby 1.3301157349487767 | |
built-ruby 1.3270998559892178 | |
built-ruby 1.3712411399465054 | |
built-ruby 1.3077540330123156 | |
----------------------------------------------------------- | |
vm2_send | |
class C | |
def m | |
end | |
end | |
o = C.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
o.__send__ :m | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5251989060780033 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5592143470421433 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5400359339546412 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.554872908978723 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5532119689742103 | |
built-ruby 0.5127090490423143 | |
built-ruby 0.4954036179697141 | |
built-ruby 0.5297531269025058 | |
built-ruby 0.48911669908557087 | |
built-ruby 0.49407414498273283 | |
----------------------------------------------------------- | |
vm2_string_literal | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
x = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.34665385994594544 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3084796310868114 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3089321069419384 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.35174350009765476 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3032875310163945 | |
built-ruby 0.3556818841025233 | |
built-ruby 0.2998379539931193 | |
built-ruby 0.31570481101516634 | |
built-ruby 0.30457645596470684 | |
built-ruby 0.4108817789237946 | |
----------------------------------------------------------- | |
vm2_struct_big_aref_hi | |
s = Struct.new(*('a'..'z').map { |x| x.to_sym }) | |
x = s.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
x.z # x[25] | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.29838010808452964 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.33999655896332115 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2895501629682258 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.36539423803333193 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3381085699656978 | |
built-ruby 0.3170730860438198 | |
built-ruby 0.3529772129841149 | |
built-ruby 0.32895411003846675 | |
built-ruby 0.3511206950061023 | |
built-ruby 0.35723876499105245 | |
----------------------------------------------------------- | |
vm2_struct_big_aref_lo | |
s = Struct.new(*('a'..'z').map { |x| x.to_sym }) | |
x = s.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
x.k # x[10] | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3578531319508329 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3488863449310884 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3420171879697591 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3262544310418889 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3288663380080834 | |
built-ruby 0.345018635969609 | |
built-ruby 0.32875688397325575 | |
built-ruby 0.32560366904363036 | |
built-ruby 0.3065255139954388 | |
built-ruby 0.3391150269890204 | |
----------------------------------------------------------- | |
vm2_struct_big_aset | |
s = Struct.new(*('a'..'z').map { |x| x.to_sym }) | |
x = s.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
x.k = i # x[10] = i | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.35130606906022877 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.34029660501983017 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.381685986998491 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.36959810298867524 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3740865809377283 | |
built-ruby 0.340481230057776 | |
built-ruby 0.3381426509004086 | |
built-ruby 0.3274879159871489 | |
built-ruby 0.34081885404884815 | |
built-ruby 0.3785911339800805 | |
----------------------------------------------------------- | |
vm2_struct_big_href_hi | |
s = Struct.new(*('a'..'z').map { |x| x.to_sym }) | |
x = s.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
x[:z] | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4190911279292777 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.42406872590072453 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.41353046894073486 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.41544463811442256 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4155788030475378 | |
built-ruby 0.4165720799937844 | |
built-ruby 0.40637945500202477 | |
built-ruby 0.41635459498502314 | |
built-ruby 0.4204686189768836 | |
built-ruby 0.42917738296091557 | |
----------------------------------------------------------- | |
vm2_struct_big_href_lo | |
s = Struct.new(*('a'..'z').map { |x| x.to_sym }) | |
x = s.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
x[:k] | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.44617557199671865 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.445432584034279 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.43015890708193183 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.40709071001037955 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.41904770594555885 | |
built-ruby 0.4057509789709002 | |
built-ruby 0.460414853063412 | |
built-ruby 0.4180753390537575 | |
built-ruby 0.47328460204880685 | |
built-ruby 0.4184348500566557 | |
----------------------------------------------------------- | |
vm2_struct_big_hset | |
s = Struct.new(*('a'..'z').map { |x| x.to_sym }) | |
x = s.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
x[:k] = i | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.487609860021621 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4508612819481641 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.43037575692869723 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.5681768209906295 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4323477760190144 | |
built-ruby 0.470006944029592 | |
built-ruby 0.4423326689284295 | |
built-ruby 0.4830686500063166 | |
built-ruby 0.474012637976557 | |
built-ruby 0.47723563096951693 | |
----------------------------------------------------------- | |
vm2_struct_small_aref | |
s = Struct.new(:a, :b, :c) | |
x = s.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
x.a | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2793347289552912 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2683165540220216 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2599930359283462 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.285065709031187 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.287401802954264 | |
built-ruby 0.2827676460146904 | |
built-ruby 0.27835497504565865 | |
built-ruby 0.27271448296960443 | |
built-ruby 0.2571972069563344 | |
built-ruby 0.24549310200382024 | |
----------------------------------------------------------- | |
vm2_struct_small_aset | |
s = Struct.new(:a, :b, :c) | |
x = s.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
x.a = i | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3804985269671306 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.33701021398883313 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.39011341496370733 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.37686154700350016 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3804389520082623 | |
built-ruby 0.3961359430104494 | |
built-ruby 0.3564011319540441 | |
built-ruby 0.3929391399724409 | |
built-ruby 0.34539266594219953 | |
built-ruby 0.3897257260978222 | |
----------------------------------------------------------- | |
vm2_struct_small_href | |
s = Struct.new(:a, :b, :c) | |
x = s.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
x[:a] | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4164629700826481 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3984802990453318 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.38632836809847504 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.42341673094779253 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4092459019739181 | |
built-ruby 0.4152171609457582 | |
built-ruby 0.3967451610369608 | |
built-ruby 0.42848581192083657 | |
built-ruby 0.39535745105240494 | |
built-ruby 0.3965323610464111 | |
----------------------------------------------------------- | |
vm2_struct_small_hset | |
s = Struct.new(:a, :b, :c) | |
x = s.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
x[:a] = 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.43300800200086087 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.405840030987747 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4531787510495633 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4087796399835497 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.4644759549992159 | |
built-ruby 0.4106982230441645 | |
built-ruby 0.39889710606075823 | |
built-ruby 0.43375748803373426 | |
built-ruby 0.4505690740188584 | |
built-ruby 0.40594870899803936 | |
----------------------------------------------------------- | |
vm2_super | |
class C | |
def m | |
1 | |
end | |
end | |
class CC < C | |
def m | |
super() | |
end | |
end | |
obj = CC.new | |
i = 0 | |
while i<6_000_000 # benchmark loop 2 | |
obj.m | |
i += 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6853680980857462 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6480090329423547 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6558889020234346 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6130874570226297 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6504613989964128 | |
built-ruby 0.6532956860028207 | |
built-ruby 0.6142148280050606 | |
built-ruby 0.6578682699473575 | |
built-ruby 0.6314947049831972 | |
built-ruby 0.6492877890123054 | |
----------------------------------------------------------- | |
vm2_unif1 | |
i = 0 | |
def m a, b | |
end | |
while i<6_000_000 # benchmark loop 2 | |
i += 1 | |
m 100, 200 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3416488509392366 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.33805370808113366 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3328374980483204 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3228982100263238 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.30499062000308186 | |
built-ruby 0.33373622095678 | |
built-ruby 0.33399873110465705 | |
built-ruby 0.2857946150470525 | |
built-ruby 0.31229540798813105 | |
built-ruby 0.29617300594691187 | |
----------------------------------------------------------- | |
vm2_zsuper | |
i = 0 | |
class C | |
def m a | |
1 | |
end | |
end | |
class CC < C | |
def m a | |
super | |
end | |
end | |
obj = CC.new | |
while i<6_000_000 # benchmark loop 2 | |
obj.m 10 | |
i += 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6209678670857102 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.7618362620705739 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6641745280940086 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6568355089984834 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6310161630390212 | |
built-ruby 0.6303672679932788 | |
built-ruby 0.6978552798973396 | |
built-ruby 0.742036669049412 | |
built-ruby 0.6332919799024239 | |
built-ruby 0.6678852620534599 | |
----------------------------------------------------------- | |
vm3_backtrace | |
# get last backtrace | |
begin | |
caller(0, 0) | |
rescue ArgumentError | |
alias caller_orig caller | |
def caller lev, n | |
caller_orig(lev)[0..n] | |
end | |
end | |
def rec n | |
if n < 0 | |
100_000.times{ | |
caller(0, 1) | |
} | |
else | |
rec(n-1) | |
end | |
end | |
rec 50 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.22997413796838373 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.21112273400649428 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.20754643296822906 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.16854821401648223 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.1783876350382343 | |
built-ruby 0.1717047441052273 | |
built-ruby 0.1716264869319275 | |
built-ruby 0.2154318660032004 | |
built-ruby 0.21559781802352518 | |
built-ruby 0.18539561098441482 | |
----------------------------------------------------------- | |
vm3_clearmethodcache | |
i = 0 | |
while i<200_000 | |
i += 1 | |
Class.new{ | |
def m; end | |
} | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3233399869641289 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.31931639509275556 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3420628639869392 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3548121979692951 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3342083210591227 | |
built-ruby 0.32320575998164713 | |
built-ruby 0.3145827710395679 | |
built-ruby 0.3596599540906027 | |
built-ruby 0.3922513120342046 | |
built-ruby 0.34864867897704244 | |
----------------------------------------------------------- | |
vm3_gc | |
5000.times do | |
100.times do | |
{"xxxx"=>"yyyy"} | |
end | |
GC.start | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4565825049066916 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.6127909700153396 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4874821739504114 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4508209599880502 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.4720979740377516 | |
built-ruby 1.4138594950782135 | |
built-ruby 1.4817460509948432 | |
built-ruby 1.4232179239625111 | |
built-ruby 1.3768265180988237 | |
built-ruby 1.3733354229480028 | |
----------------------------------------------------------- | |
vm3_gc_old_full | |
old_object = Array.new(1_000_000){''} | |
100.times do | |
GC.start | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.3804282639175653 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.360886448994279 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.3795669618993998 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.3059421150246635 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.293723420938477 | |
built-ruby 3.3484380450099707 | |
built-ruby 3.377359615988098 | |
built-ruby 3.3181581719545648 | |
built-ruby 3.3055209149606526 | |
built-ruby 3.2479409070219845 | |
----------------------------------------------------------- | |
vm3_gc_old_immediate | |
old_object = Array.new(1_000_000){''} | |
30_000.times do | |
GC.start(full_mark: false, immediate_sweep: true) | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.809362306026742 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.8465095019200817 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.0078539120731875 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.027784492005594 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.000528441974893 | |
built-ruby 2.8972228970378637 | |
built-ruby 3.1001153270481154 | |
built-ruby 3.061605235096067 | |
built-ruby 2.906369192060083 | |
built-ruby 3.050990574993193 | |
----------------------------------------------------------- | |
vm3_gc_old_lazy | |
old_object = Array.new(1_000_000){''} | |
30_000.times do | |
GC.start(full_mark: false, immediate_sweep: false) | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.906487589934841 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.134856679942459 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.8369784200331196 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.7586515470175073 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 3.967423382913694 | |
built-ruby 3.8638424179516733 | |
built-ruby 4.083651466993615 | |
built-ruby 3.778044708073139 | |
built-ruby 4.115537403034978 | |
built-ruby 3.824456701055169 | |
----------------------------------------------------------- | |
vm_symbol_block_pass | |
class C | |
1000.times {|i| | |
eval("def i#{i};end") | |
} | |
end | |
c = C.new | |
m = C.instance_methods(false) | |
5_000.times do | |
m.each do |n| | |
c.tap(&n) | |
end | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1257652869680896 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1856958860298619 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.0764278889400885 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1576168929459527 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1552929839817807 | |
built-ruby 1.1283993049291894 | |
built-ruby 1.1149126599775627 | |
built-ruby 1.1423722270410508 | |
built-ruby 1.1790088919224218 | |
built-ruby 1.0886345269391313 | |
----------------------------------------------------------- | |
vm_thread_alive_check1 | |
5_000.times{ | |
t = Thread.new{} | |
while t.alive? | |
Thread.pass | |
end | |
} | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.250905264983885 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2244327290682122 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.20746608497574925 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.18340853101108223 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.21054480504244566 | |
built-ruby 0.21525695291347802 | |
built-ruby 0.2222082270309329 | |
built-ruby 0.21031203493475914 | |
built-ruby 0.21567859209608287 | |
built-ruby 0.23049798200372607 | |
----------------------------------------------------------- | |
vm_thread_close | |
1000.times { Thread.new { sleep } } | |
i = 0 | |
while i<100_000 # benchmark loop 3 | |
i += 1 | |
IO.pipe.each(&:close) | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.6472671129740775 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.07868930301629 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.899174139020033 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 5.846925333025865 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 6.39158919500187 | |
built-ruby 5.62468595802784 | |
built-ruby 5.691013601026498 | |
built-ruby 4.814508448005654 | |
built-ruby 5.904351843055338 | |
built-ruby 4.552630113903433 | |
----------------------------------------------------------- | |
vm_thread_create_join | |
i = 0 | |
while i<100_000 # benchmark loop 3 | |
i += 1 | |
Thread.new{ | |
}.join | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.5239056260325015 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.411398481926881 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.215117954998277 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.363031704095192 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 4.347520570969209 | |
built-ruby 4.337680438999087 | |
built-ruby 4.535930744954385 | |
built-ruby 4.1838729929877445 | |
built-ruby 4.380066936952062 | |
built-ruby 4.4904781189979985 | |
----------------------------------------------------------- | |
vm_thread_mutex1 | |
# one thread, one mutex (no contention) | |
require 'thread' | |
m = Thread::Mutex.new | |
r = 0 | |
max = 2000 | |
lmax = max * max | |
(1..1).map{ | |
Thread.new{ | |
i = 0 | |
while i<lmax | |
i += 1 | |
m.synchronize{ | |
r += 1 | |
} | |
end | |
} | |
}.each{|e| | |
e.join | |
} | |
raise r.to_s if r != max * max | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6662177360849455 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6705055671045557 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6909727910533547 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6474885119823739 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.6326415820512921 | |
built-ruby 0.649574670009315 | |
built-ruby 0.6786495490232483 | |
built-ruby 0.6666031350614503 | |
built-ruby 0.7354894110467285 | |
built-ruby 0.6377919759834185 | |
----------------------------------------------------------- | |
vm_thread_mutex2 | |
# two threads, one mutex | |
require 'thread' | |
m = Thread::Mutex.new | |
r = 0 | |
max = 2000 | |
lmax = (max * max)/2 | |
(1..2).map{ | |
Thread.new{ | |
i = 0 | |
while i<lmax | |
i += 1 | |
m.synchronize{ | |
r += 1 | |
} | |
end | |
} | |
}.each{|e| | |
e.join | |
} | |
raise r.to_s if r != max * max | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.1216140550095588 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.495425326982513 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.6953884069807827 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 2.1321476340526715 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 1.7086537859868258 | |
built-ruby 1.9019261099165305 | |
built-ruby 1.622454366995953 | |
built-ruby 2.3639166170032695 | |
built-ruby 2.0896611040225253 | |
built-ruby 2.2645893619628623 | |
----------------------------------------------------------- | |
vm_thread_mutex3 | |
# 1000 threads, one mutex | |
require 'thread' | |
m = Thread::Mutex.new | |
r = 0 | |
max = 2000 | |
(1..max).map{ | |
Thread.new{ | |
i = 0 | |
while i<max | |
i += 1 | |
m.synchronize{ | |
r += 1 | |
} | |
end | |
} | |
}.each{|e| | |
e.join | |
} | |
raise r.to_s if r != max * max | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 27.397930574021302 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 23.5423261069227 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 25.471124968025833 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 19.435467693023384 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 8.593432280002162 | |
built-ruby 20.13779211998917 | |
built-ruby 22.57824261195492 | |
built-ruby 28.509413485066034 | |
built-ruby 30.53807972604409 | |
built-ruby 27.98444297106471 | |
----------------------------------------------------------- | |
vm_thread_pass | |
# Plenty Thtread.pass | |
# A performance may depend on GVL implementation. | |
tmax = (ARGV.shift || 2).to_i | |
lmax = 200_000 / tmax | |
(1..tmax).map{ | |
Thread.new{ | |
lmax.times{ | |
Thread.pass | |
} | |
} | |
}.each{|t| t.join} | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.32933060301002115 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.36675145104527473 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.34230901196133345 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3963512961054221 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3537983709247783 | |
built-ruby 0.40798689099028707 | |
built-ruby 0.37036699790041894 | |
built-ruby 0.42855509906075895 | |
built-ruby 0.4345944150118157 | |
built-ruby 0.3863320150412619 | |
----------------------------------------------------------- | |
vm_thread_pass_flood | |
1000.times{ | |
Thread.new{loop{Thread.pass}} | |
} | |
i = 0 | |
while i<10000 | |
i += 1 | |
end | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.1561750159598887 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.25159286498092115 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.14752352493815124 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.22476911207195371 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.1402553409570828 | |
built-ruby 0.10077841905876994 | |
built-ruby 0.09581942507065833 | |
built-ruby 0.14532443694770336 | |
built-ruby 0.24667707702610642 | |
built-ruby 0.13841347699053586 | |
----------------------------------------------------------- | |
vm_thread_pipe | |
# Measure small and plenty pipe read/write. | |
# A performance may depend on GVL implementation. | |
lmax = 100_000 | |
r, w = IO.pipe | |
[Thread.new{ | |
lmax.times{ | |
w.write('a') | |
} | |
p "w:exit" | |
}, Thread.new{ | |
lmax.times{ | |
r.read(1) | |
} | |
p "r:exit" | |
}].each{|t| t.join} | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.2924502049572766 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.3836949690012261 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.33484510995913297 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.30142869404517114 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.31491148797795177 | |
built-ruby 0.37183289998210967 | |
built-ruby 0.28924837394151837 | |
built-ruby 0.3221808939706534 | |
built-ruby 0.2940054330974817 | |
built-ruby 0.26863185898400843 | |
----------------------------------------------------------- | |
vm_thread_queue | |
require 'thread' | |
n = 1_000_000 | |
q = Thread::Queue.new | |
consumer = Thread.new{ | |
while q.pop | |
# consuming | |
end | |
} | |
producer = Thread.new{ | |
n.times{ | |
q.push true | |
} | |
q.push nil | |
} | |
consumer.join | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.16626917908433825 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.15921901795081794 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.19360081700142473 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.19142317795194685 | |
ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] 0.15079771599266678 | |
built-ruby 0.19283601292409003 | |
built-ruby 0.2019919849699363 | |
built-ruby 0.21107392001431435 | |
built-ruby 0.18322816700674593 | |
built-ruby 0.16120479395613074 | |
----------------------------------------------------------- | |
raw data: | |
[["app_answer", | |
[[0.054968526936136186, | |
0.043999257031828165, | |
0.043813185999169946, | |
0.06688361300621182, | |
0.06308504904154688], | |
[0.06399883492849767, | |
0.047931801062077284, | |
0.07002927793655545, | |
0.04975632997229695, | |
0.06824782805051655]]], | |
["app_aobench", | |
[[54.58599109004717, | |
55.576182116987184, | |
55.796338962973095, | |
55.292317920946516, | |
55.461386871989816], | |
[51.75369838497136, | |
51.12740166299045, | |
52.270437979954295, | |
50.30211525806226, | |
51.37324380793143]]], | |
["app_erb", | |
[[2.231968601932749, | |
2.214464233024046, | |
2.2946588959312066, | |
2.2567868429468945, | |
2.302027763915248], | |
[2.3040525909746066, | |
2.373874614946544, | |
2.360743193072267, | |
2.296779378084466, | |
2.3394880950218067]]], | |
["app_factorial", | |
[[0.8302856918890029, | |
0.8107500380137935, | |
0.8689422660972923, | |
0.8381959450198337, | |
0.8038355390308425], | |
[0.8040747550548986, | |
0.8507883159909397, | |
0.798156816046685, | |
0.805755464010872, | |
0.8560758630046621]]], | |
["app_fib", | |
[[0.5394219270674512, | |
0.5461057809880003, | |
0.5409830220742151, | |
0.5282882750034332, | |
0.542332053068094], | |
[0.5090699099237099, | |
0.49279818299692124, | |
0.503557913005352, | |
0.529371326090768, | |
0.5138792649377137]]], | |
["app_lc_fizzbuzz", | |
[[69.99791057093535, | |
70.33638256508857, | |
69.43688092799857, | |
68.59378365206067, | |
71.47225636104122], | |
[40.99161151901353, | |
41.49508108908776, | |
42.590445040958, | |
44.49675606191158, | |
42.17322386696469]]], | |
["app_mandelbrot", | |
[[1.4691719140391797, | |
1.4137170379981399, | |
1.439615415991284, | |
1.4169191860128194, | |
1.4996583830798045], | |
[1.4342095679603517, | |
1.4227394519839436, | |
1.4569037030451, | |
1.3930311589501798, | |
1.4416190939955413]]], | |
["app_pentomino", | |
[[16.955009859986603, | |
17.016228512045927, | |
17.123202687012963, | |
17.22535213001538, | |
17.16649117495399], | |
[17.548675701022148, | |
17.592179167084396, | |
17.548861957970075, | |
17.845728643005714, | |
17.710411740932614]]], | |
["app_raise", | |
[[0.24152075592428446, | |
0.30898132803849876, | |
0.2403825499350205, | |
0.25906085793394595, | |
0.26233157294336706], | |
[0.25932497496251017, | |
0.2245949930511415, | |
0.23073543095961213, | |
0.21433765604160726, | |
0.22223564109299332]]], | |
["app_strconcat", | |
[[1.099352365010418, | |
1.1284073980059475, | |
1.0681289340136573, | |
1.0726434210082516, | |
1.1101944859838113], | |
[1.1025448340224102, | |
1.211157893994823, | |
1.1006269420031458, | |
1.0723086389480159, | |
1.114692494040355]]], | |
["app_tak", | |
[[0.7760888659395278, | |
0.7183313800487667, | |
0.800829699030146, | |
0.7779099229956046, | |
0.7689379589864984], | |
[0.7379660790320486, | |
0.7507547120330855, | |
0.7746493939775974, | |
0.7573163129854947, | |
0.7513459080364555]]], | |
["app_tarai", | |
[[0.6000802039634436, | |
0.6422550959978253, | |
0.6254906730027869, | |
0.6682855940889567, | |
0.6114415570627898], | |
[0.6225703150266781, | |
0.619686861988157, | |
0.6119015109725296, | |
0.6365446960553527, | |
0.6483560899505392]]], | |
["app_uri", | |
[[0.6080217339331284, | |
0.5974279250949621, | |
0.6283238979522139, | |
0.5964365160325542, | |
0.5917318909196183], | |
[0.5834868639940396, | |
0.5648214350221679, | |
0.6081726279808208, | |
0.5777335789753124, | |
0.5967385330004618]]], | |
["array_shift", | |
[[19.911575963022187, | |
21.80540126003325, | |
21.684410477988422, | |
19.361100711044855, | |
20.460079101030715], | |
[20.590318536036648, | |
20.145105980103835, | |
18.954186240094714, | |
18.368444312014617, | |
19.730205620988272]]], | |
["hash_aref_dsym", | |
[[0.4216823069145903, | |
0.3622758809942752, | |
0.38479660102166235, | |
0.40343340998515487, | |
0.49036661093123257], | |
[0.43174306803848594, | |
0.5595700640697032, | |
0.5306916529079899, | |
0.5160241100238636, | |
0.39117593702394515]]], | |
["hash_aref_dsym_long", | |
[[8.994142417912371, | |
8.65070200106129, | |
8.894787893048488, | |
8.891105056973174, | |
8.985472270986065], | |
[9.263988000922836, | |
8.880853733047843, | |
8.88276363699697, | |
8.975527776987292, | |
9.016328673926182]]], | |
["hash_aref_fix", | |
[[0.37598705396521837, | |
0.365062219905667, | |
0.41727619199082255, | |
0.4163406129227951, | |
0.4131853310391307], | |
[0.42576511297374964, | |
0.39972475508693606, | |
0.4207646220456809, | |
0.42259231791831553, | |
0.4202495509525761]]], | |
["hash_aref_flo", | |
[[0.11718685796950012, | |
0.11380171892233193, | |
0.08189995994325727, | |
0.07708744995761663, | |
0.09865439892746508], | |
[0.11252881400287151, | |
0.08053674502298236, | |
0.07900785398669541, | |
0.11016465292777866, | |
0.11145737406332046]]], | |
["hash_aref_miss", | |
[[0.6566751280333847, | |
0.5181243579136208, | |
0.4812287100357935, | |
0.4952475589234382, | |
0.5520137930288911], | |
[0.5301608719164506, | |
0.7099478869931772, | |
0.687668439000845, | |
0.505970490979962, | |
0.6379513390129432]]], | |
["hash_aref_str", | |
[[0.46142047201283276, | |
0.557503585005179, | |
0.44997511396650225, | |
0.473411327926442, | |
0.4952690149657428], | |
[0.5121987810125574, | |
0.5139237380353734, | |
0.5129490919644013, | |
0.549338715034537, | |
0.510490596992895]]], | |
["hash_aref_sym", | |
[[0.3888717930531129, | |
0.35667734197340906, | |
0.35198676493018866, | |
0.35674102103803307, | |
0.40656316094100475], | |
[0.37652272009290755, | |
0.38751485000830144, | |
0.3706149799982086, | |
0.3702603030251339, | |
0.3512671149801463]]], | |
["hash_aref_sym_long", | |
[[0.5792624419555068, | |
0.560205984977074, | |
0.541156632010825, | |
0.5849411159288138, | |
0.5847152499482036], | |
[0.5648888240102679, | |
0.5205608840333298, | |
0.5261825050693005, | |
0.5629314871039242, | |
0.5783154160017148]]], | |
["hash_flatten", | |
[[0.3427213099785149, | |
0.3069341860245913, | |
0.34275468497071415, | |
0.38032072596251965, | |
0.346936195041053], | |
[0.32654421601910144, | |
0.3373371420893818, | |
0.34255180205218494, | |
0.3248691939515993, | |
0.34191841701976955]]], | |
["hash_ident_flo", | |
[[0.04220124601852149, | |
0.041269097942858934, | |
0.04389087401796132, | |
0.04291684599593282, | |
0.07074739702511579], | |
[0.05692592798732221, | |
0.044749675085768104, | |
0.0664445529691875, | |
0.07258922001346946, | |
0.07019294996280223]]], | |
["hash_ident_num", | |
[[0.39377539709676057, | |
0.39119664498139173, | |
0.3880777000449598, | |
0.40493444295134395, | |
0.36523314204532653], | |
[0.3929379280889407, | |
0.34873612003866583, | |
0.3442114370409399, | |
0.38300986506510526, | |
0.37529788399115205]]], | |
["hash_ident_obj", | |
[[0.3828392189461738, | |
0.35609906795434654, | |
0.3869356900686398, | |
0.38341773208230734, | |
0.37513233406934887], | |
[0.36865005106665194, | |
0.4118203339166939, | |
0.35567324492149055, | |
0.37416579702403396, | |
0.3900904100155458]]], | |
["hash_ident_str", | |
[[0.377036583959125, | |
0.3820425069425255, | |
0.36399687302764505, | |
0.34358865895774215, | |
0.34478977404069155], | |
[0.3856695689028129, | |
0.3960615099640563, | |
0.39091065991669893, | |
0.362755179987289, | |
0.48463089496362954]]], | |
["hash_ident_sym", | |
[[0.3676063900347799, | |
0.372383851907216, | |
0.3768876070389524, | |
0.3810834060423076, | |
0.3695543850772083], | |
[0.40730858489405364, | |
0.35844991891644895, | |
0.3562260299222544, | |
0.36219201888889074, | |
0.3705180719261989]]], | |
["hash_keys", | |
[[0.3813573819352314, | |
0.40435454109683633, | |
0.36419785604812205, | |
0.36185255693271756, | |
0.37647308001760393], | |
[0.37183589406777173, | |
0.37212479999288917, | |
0.3915642349747941, | |
0.3662926279939711, | |
0.3848387829493731]]], | |
["hash_shift", | |
[[0.019978645024821162, | |
0.02057298901490867, | |
0.021030289004556835, | |
0.02016332291532308, | |
0.020496617071330547], | |
[0.019983322941698134, | |
0.019883542088791728, | |
0.01988018094561994, | |
0.019127018051221967, | |
0.019923339947126806]]], | |
["hash_shift_u16", | |
[[0.10453401308041066, | |
0.09176352899521589, | |
0.11688991403207183, | |
0.09428807406220585, | |
0.0933125379960984], | |
[0.0919919959269464, | |
0.1384998329449445, | |
0.09584043198265135, | |
0.142563764937222, | |
0.14312137803062797]]], | |
["hash_shift_u24", | |
[[0.1365325200604275, | |
0.11648659699130803, | |
0.09805822500493377, | |
0.09307972399983555, | |
0.09942812204826623], | |
[0.13245002599433064, | |
0.13298956002108753, | |
0.09465779503807425, | |
0.1013404109980911, | |
0.13682444905862212]]], | |
["hash_shift_u32", | |
[[0.08892942301463336, | |
0.08826780295930803, | |
0.10507124394644052, | |
0.0913004920585081, | |
0.13256571907550097], | |
[0.09448003501165658, | |
0.1459165009437129, | |
0.09830889292061329, | |
0.09352237393613905, | |
0.13785196701064706]]], | |
["hash_to_proc", | |
[[0.019653267925605178, | |
0.01671880902722478, | |
0.015707271988503635, | |
0.01917582901660353, | |
0.016913854982703924], | |
[0.016896598041057587, | |
0.01782079297117889, | |
0.018575310008600354, | |
0.016450647031888366, | |
0.010085696005262434]]], | |
["hash_values", | |
[[0.38122058392036706, | |
0.34331048699095845, | |
0.3440139730228111, | |
0.3586773299612105, | |
0.35639152803923935], | |
[0.3473863329272717, | |
0.35828115697950125, | |
0.3558147290023044, | |
0.3774512440431863, | |
0.40638430789113045]]], | |
["io_file_create", | |
[[1.0968290109885857, | |
1.069951456040144, | |
1.1728365051094443, | |
1.1180928848916665, | |
1.1327887700172141], | |
[1.245755268028006, | |
1.1043767239898443, | |
1.1141724679619074, | |
1.1341513060033321, | |
1.1506679240847006]]], | |
["io_file_read", | |
[[1.4777622310211882, | |
1.4042066799011081, | |
1.4235800999449566, | |
1.3972327669616789, | |
1.4454854049254209], | |
[1.452328918967396, | |
1.4763240709435195, | |
1.4212326299166307, | |
1.4206862730206922, | |
1.4323099629255012]]], | |
["io_file_write", | |
[[0.5536080140154809, | |
0.5973453510086983, | |
0.5510142010170966, | |
0.5829400019720197, | |
0.5641764220781624], | |
[0.5483221609611064, | |
0.5867528859525919, | |
0.6009624869329855, | |
0.5745283620199189, | |
0.5461939809611067]]], | |
["io_nonblock_noex", [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]], | |
["io_nonblock_noex2", [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]], | |
["io_select", | |
[[1.3566845810273662, | |
1.3276568519650027, | |
1.3886774969287217, | |
1.4759572820039466, | |
1.381032899953425], | |
[1.4428902280051261, | |
1.398780834977515, | |
1.4073024929966778, | |
1.403941371012479, | |
1.390713831060566]]], | |
["io_select2", | |
[[1.6995966200483963, | |
1.6652121299412102, | |
1.6420642510056496, | |
1.8304848399711773, | |
1.6703923679888248], | |
[1.6714988009771332, | |
1.661516672000289, | |
1.658023179974407, | |
1.7248587399953976, | |
1.6729385469807312]]], | |
["io_select3", | |
[[0.08045057998970151, | |
0.08171069796662778, | |
0.08577974699437618, | |
0.08378621900919825, | |
0.09031901403795928], | |
[0.09006700303871185, | |
0.07957196491770446, | |
0.08113130403216928, | |
0.07871861499734223, | |
0.08099054102785885]]], | |
["loop_for", | |
[[1.429033393971622, | |
1.3902404700638726, | |
1.3368758759461343, | |
1.5224818449933082, | |
1.3832816269714385], | |
[1.4056512729730457, | |
1.3982130440417677, | |
1.4856738760136068, | |
1.4355269520310685, | |
1.3960542739368975]]], | |
["loop_generator", | |
[[0.447983055957593, | |
0.43713122291956097, | |
0.41632595006376505, | |
0.413728442043066, | |
0.43117495195474476], | |
[0.3936361169908196, | |
0.41520697495434433, | |
0.3813484450802207, | |
0.4186007340904325, | |
0.46606297697871923]]], | |
["loop_times", | |
[[1.2660569730214775, | |
1.288977800984867, | |
1.2790794249158353, | |
1.2557534169172868, | |
1.242581072030589], | |
[1.367729538003914, | |
1.2490719420602545, | |
1.2537770349299535, | |
1.3036859730491415, | |
1.315647570998408]]], | |
["loop_whileloop", | |
[[0.6696008009603247, | |
0.6613349430263042, | |
0.6545510729774833, | |
0.7210862779757008, | |
0.6868640170432627], | |
[0.7538669649511576, | |
0.6594554899493232, | |
0.6867847840767354, | |
0.7034585719229653, | |
0.676485852105543]]], | |
["loop_whileloop2", | |
[[0.16582438093610108, | |
0.1785859070951119, | |
0.1345876029226929, | |
0.19371888297609985, | |
0.1576415990712121], | |
[0.18836930592078716, | |
0.17945012100972235, | |
0.13904708600603044, | |
0.13976143905892968, | |
0.16039950295817107]]], | |
["marshal_dump_flo", | |
[[0.40514840092509985, | |
0.4423090369673446, | |
0.4337517569074407, | |
0.4403481970075518, | |
0.3930218250025064], | |
[0.4278980160597712, | |
0.43506750697270036, | |
0.4263163349824026, | |
0.42774789698887616, | |
0.4529707379406318]]], | |
["marshal_dump_load_geniv", | |
[[0.6123521019471809, | |
0.6119896658929065, | |
0.6105287390528247, | |
0.6229553610319272, | |
0.6130104489857331], | |
[0.6296117239398882, | |
0.6413133019814268, | |
0.589495872030966, | |
0.597406764049083, | |
0.5956406740006059]]], | |
["marshal_dump_load_time", | |
[[1.700435527949594, | |
1.7273683469975367, | |
1.6878731369506568, | |
1.8823049339698628, | |
1.695577287930064], | |
[1.7563206269405782, | |
1.874093962018378, | |
1.7417739329393953, | |
1.8114637369289994, | |
1.750103313010186]]], | |
["require", | |
[[1.0619833109667525, | |
0.9308968300465494, | |
1.0666463939705864, | |
0.8810079169925302, | |
0.8796678589424118], | |
[0.9250150509178638, | |
0.8820322109386325, | |
0.8508778579998761, | |
0.9202019539661705, | |
0.9012398619670421]]], | |
["require_thread", | |
[[0.21662832389120013, | |
0.22078900691121817, | |
0.5179030389990658, | |
0.5129538390319794, | |
0.5115444009425119], | |
[0.31828783394303173, | |
0.32342322205659, | |
0.21796219993848354, | |
0.4137510540895164, | |
0.1225852380739525]]], | |
["securerandom", | |
[[0.26040642301086336, | |
0.2563073959900066, | |
0.2603783579543233, | |
0.27299292106181383, | |
0.2926094400463626], | |
[0.2890160030219704, | |
0.2857340909540653, | |
0.29148439900018275, | |
0.24334233906120062, | |
0.28515519900247455]]], | |
["so_ackermann", | |
[[0.7351798920426518, | |
0.6416415710700676, | |
0.6314938109135255, | |
0.6161993889836594, | |
0.6308393200160936], | |
[0.6026810819748789, | |
0.5840895769651979, | |
0.5894482340663671, | |
0.5874529340071604, | |
0.563191408989951]]], | |
["so_array", | |
[[0.9406678340164945, | |
0.9825775140197948, | |
0.9287008650135249, | |
0.9349297150038183, | |
0.9208299829624593], | |
[0.9324882669607177, | |
0.938745960011147, | |
1.01670901698526, | |
0.9396806108998135, | |
0.9004901159787551]]], | |
["so_binary_trees", | |
[[6.260964497923851, | |
6.2369194839848205, | |
6.4077904800651595, | |
6.403173052938655, | |
6.439292576978914], | |
[5.983900416991673, | |
6.202562858001329, | |
6.169638277031481, | |
6.154955621925183, | |
6.205964269000106]]], | |
["so_concatenate", | |
[[4.001141563989222, | |
4.09834510309156, | |
4.112204045988619, | |
4.056181942927651, | |
4.053268599906005], | |
[4.231184215983376, | |
4.214553599944338, | |
4.225530072930269, | |
4.23357527400367, | |
4.446332956082188]]], | |
["so_count_words", | |
[[0.18317602504976094, | |
0.16097911505494267, | |
0.1944847139529884, | |
0.16829874098766595, | |
0.1914049789775163], | |
[0.1907938700169325, | |
0.15760852908715606, | |
0.15018033992964774, | |
0.1822699890471995, | |
0.14878833096008748]]], | |
["so_exception", | |
[[0.2948280469281599, | |
0.3389579759677872, | |
0.3021621649386361, | |
0.297112351981923, | |
0.32233828597236425], | |
[0.3171930620446801, | |
0.2824935069074854, | |
0.29181393200997263, | |
0.27976310497615486, | |
0.28373940801247954]]], | |
["so_fannkuch", | |
[[1.195548600051552, | |
1.2603375089820474, | |
1.173193629947491, | |
1.230126878945157, | |
1.3135004850337282], | |
[1.222666513058357, | |
1.1949388809734955, | |
1.188238336937502, | |
1.214579998049885, | |
1.1952616450143978]]], | |
["so_fasta", | |
[[2.0799837020458654, | |
2.0712170960614458, | |
2.025488005951047, | |
2.099908426986076, | |
2.051318514975719], | |
[1.9957283459370956, | |
1.9421377900289372, | |
1.9475463649723679, | |
1.9905491810059175, | |
1.9425933110760525]]], | |
["so_k_nucleotide", | |
[[1.3331258340040222, | |
1.3210365020204335, | |
1.2975040499586612, | |
1.2961266150232404, | |
1.2919675910379738], | |
[1.3116200920194387, | |
1.8578620590269566, | |
1.2753536959644407, | |
1.2576407550368458, | |
1.3670301890233532]]], | |
["so_lists", | |
[[0.6434617630438879, | |
0.5584338919725269, | |
0.6284601120278239, | |
0.5885989199159667, | |
0.569430175004527], | |
[0.5566898250253871, | |
0.5767613250063732, | |
0.536732375039719, | |
0.5868497409392148, | |
0.5715375680010766]]], | |
["so_mandelbrot", | |
[[2.6933954290580004, | |
2.719763809000142, | |
2.7030250899260864, | |
2.710448632016778, | |
2.6677420960040763], | |
[2.582454991992563, | |
2.630644400953315, | |
2.610673886956647, | |
2.5824020489817485, | |
2.57853459904436]]], | |
["so_matrix", | |
[[0.5532322749495506, | |
0.5392589321127161, | |
0.5494304629974067, | |
0.5443849539151415, | |
0.5887995599769056], | |
[0.57345147698652, | |
0.548274885979481, | |
0.5917947690468282, | |
0.5585711450548843, | |
0.5582691869931296]]], | |
["so_meteor_contest", | |
[[3.214573436998762, | |
3.1098699789727107, | |
3.2271991709712893, | |
3.1673258210066706, | |
3.161870562005788], | |
[3.284487602999434, | |
3.1628922530217096, | |
3.23014268593397, | |
3.2681007150094956, | |
3.2358279089676216]]], | |
["so_nbody", | |
[[1.4895762570668012, | |
1.4316055789822713, | |
1.845774877932854, | |
1.619503965950571, | |
1.4358512359904125], | |
[1.489605403970927, | |
1.6369827128946781, | |
1.4628069479949772, | |
1.4912516539916396, | |
1.5065212330082431]]], | |
["so_nested_loop", | |
[[1.1538302639964968, | |
1.1864004079252481, | |
1.2282375219510868, | |
1.138558418955654, | |
1.16007225390058], | |
[1.185616576927714, | |
1.1600782250752673, | |
1.1420731919351965, | |
1.1650092269992456, | |
1.2048731839749962]]], | |
["so_nsieve", | |
[[2.6415367040317506, | |
2.6886816358892247, | |
2.6680605559377, | |
2.6920543529558927, | |
2.782741497969255], | |
[2.6169516319641843, | |
3.1001667861128226, | |
2.6669340380467474, | |
2.6808960790513083, | |
2.7213375431019813]]], | |
["so_nsieve_bits", | |
[[2.301028444082476, | |
2.2683443799614906, | |
2.3539857430150732, | |
2.322234852006659, | |
2.3135949260322377], | |
[2.3850281490013003, | |
2.345874104066752, | |
2.378566651022993, | |
2.3643613040912896, | |
2.3432405130006373]]], | |
["so_object", | |
[[0.7316628498956561, | |
0.7300474169896916, | |
0.7387221120297909, | |
0.7108710629399866, | |
0.6899573819246143], | |
[0.7220470539759845, | |
0.6960933840600774, | |
0.7012202719924971, | |
0.7292858430882916, | |
0.7503255079500377]]], | |
["so_partial_sums", | |
[[2.500978328054771, | |
2.635557516012341, | |
2.560625697951764, | |
2.581163607072085, | |
2.5816292610252276], | |
[2.362442729063332, | |
2.4183926139958203, | |
2.3625309329945594, | |
2.341785904020071, | |
2.298863000003621]]], | |
["so_pidigits", | |
[[1.1014664309332147, | |
1.131148666027002, | |
1.1265840419800952, | |
1.1504818280227482, | |
1.0819793560076505], | |
[1.122832366032526, | |
1.10261272394564, | |
1.1235766469035298, | |
1.0744329700246453, | |
1.1077712529804558]]], | |
["so_random", | |
[[0.7285520100267604, | |
0.6450352750252932, | |
0.6077214890392497, | |
0.6734153520083055, | |
0.6686573839979246], | |
[0.628942308947444, | |
0.6288085500709713, | |
0.5946870530024171, | |
0.6637242790311575, | |
0.6055637079989538]]], | |
["so_reverse_complement", | |
[[1.4943940199445933, | |
1.440265225013718, | |
1.445961530902423, | |
1.435811645933427, | |
1.4018389220582321], | |
[1.469454557984136, | |
1.4507102069910616, | |
1.4145648250123486, | |
1.455602815025486, | |
1.4465106899151579]]], | |
["so_sieve", | |
[[0.660474959993735, | |
0.6891729219350964, | |
0.6417632529046386, | |
0.6398323100293055, | |
0.6328638480044901], | |
[0.6445695080328733, | |
0.6266142230015248, | |
0.6595635160338134, | |
0.6133787289727479, | |
0.5951220249990001]]], | |
["so_spectralnorm", | |
[[2.059270013938658, | |
1.9691427529323846, | |
2.0123793249949813, | |
2.1967068141093478, | |
2.023914583027363], | |
[1.9620243050158024, | |
2.0216803189832717, | |
2.025437308009714, | |
2.004478244925849, | |
1.990443977061659]]], | |
["vm1_attr_ivar", | |
[[1.3876241719117388, | |
1.423093921970576, | |
1.4063733690418303, | |
1.3726484590442851, | |
1.4575823689810932], | |
[1.4028229980031028, | |
1.3671701760031283, | |
1.3549646720057353, | |
1.3731246680254117, | |
1.3669164490420371]]], | |
["vm1_attr_ivar_set", | |
[[1.5688812079606578, | |
1.5478982600616291, | |
1.5380625020479783, | |
1.5633647539652884, | |
1.620823297998868], | |
[1.5418967349687591, | |
1.48236778692808, | |
1.5228633630322292, | |
1.5233477290021256, | |
1.5486485019791871]]], | |
["vm1_block", | |
[[2.246818611980416, | |
2.2079854790354148, | |
2.213123625027947, | |
2.2354054159950465, | |
2.1953787250677124], | |
[2.201612767064944, | |
2.523623585002497, | |
2.1377351749688387, | |
2.0588061809539795, | |
2.1557904719375074]]], | |
["vm1_const", | |
[[1.0557627399684861, | |
1.0482352750841528, | |
0.9834175130818039, | |
1.013727328972891, | |
1.0749761029146612], | |
[1.0029777029994875, | |
1.006267064018175, | |
0.958953044959344, | |
0.9535192149924114, | |
0.9709162269718945]]], | |
["vm1_ensure", | |
[[0.6617931340588257, | |
0.677746835979633, | |
0.6652506350073963, | |
0.674703765893355, | |
0.7130720471031964], | |
[0.6786994088906795, | |
0.6699052449548617, | |
0.6772454179590568, | |
0.6550830299966037, | |
0.6925848430255428]]], | |
["vm1_float_simple", | |
[[5.074818579014391, | |
5.165055634919554, | |
5.035747924004681, | |
5.166535242926329, | |
5.092950901016593], | |
[4.838305815006606, | |
4.97397249401547, | |
4.876350463018753, | |
4.890076918061823, | |
5.272137445979752]]], | |
["vm1_gc_short_lived", | |
[[5.572701918077655, | |
5.545986801967956, | |
6.000963474041782, | |
5.556481067091227, | |
5.485821065958589], | |
[5.838013182044961, | |
5.816040721023455, | |
5.821146882022731, | |
5.810023466008715, | |
5.772213945980184]]], | |
["vm1_gc_short_with_complex_long", | |
[[6.944078120985068, | |
6.91458666708786, | |
6.887309234007262, | |
6.812018226017244, | |
6.778544000000693], | |
[6.990529346978292, | |
7.437959754955955, | |
7.150567961973138, | |
7.282231591991149, | |
6.9792400759179145]]], | |
["vm1_gc_short_with_long", | |
[[7.850343853002414, | |
7.762539469986223, | |
6.861532868002541, | |
7.878978183027357, | |
7.914530333015136], | |
[7.6992403760086745, | |
7.291564689017832, | |
7.528386167017743, | |
7.521672914037481, | |
7.850672955042683]]], | |
["vm1_gc_short_with_symbol", | |
[[5.418937964946963, | |
5.385293962084688, | |
5.367769657052122, | |
5.473877201904543, | |
5.48634485702496], | |
[5.690719706937671, | |
5.643763103988022, | |
5.633787351078354, | |
5.613751008058898, | |
5.717727579060011]]], | |
["vm1_gc_wb_ary", | |
[[1.4957145610824227, | |
1.3121602110331878, | |
1.3108665400650352, | |
1.3237949339672923, | |
1.380240107071586], | |
[1.2927148959133774, | |
1.334393939934671, | |
1.326941855950281, | |
1.2956522499443963, | |
1.3605772809823975]]], | |
["vm1_gc_wb_ary_promoted", | |
[[1.3682217249879614, | |
1.3558116810163483, | |
1.360071693896316, | |
1.3655561860650778, | |
1.3565650300588459], | |
[1.3655343720456585, | |
1.3614942979766056, | |
1.3698562079807743, | |
1.354985506972298, | |
1.3573237539967522]]], | |
["vm1_gc_wb_obj", | |
[[1.0992813609773293, | |
1.1019161560107023, | |
1.1150748250074685, | |
1.1471848729997873, | |
1.16383711702656], | |
[1.183711896999739, | |
1.2077994539868087, | |
1.1470503279706463, | |
1.1518515850184485, | |
1.1603614799678326]]], | |
["vm1_gc_wb_obj_promoted", | |
[[1.142343875952065, | |
1.21332610596437, | |
1.2029662259155884, | |
1.1734894380206242, | |
1.2440429279813543], | |
[1.1906692289048806, | |
1.147119683912024, | |
1.2236301820958033, | |
1.2194672190817073, | |
1.1963192019611597]]], | |
["vm1_ivar", | |
[[0.9659482229035348, | |
0.9386006289860234, | |
1.0074852700345218, | |
0.9076412020949647, | |
1.006104167085141], | |
[0.9365795280318707, | |
0.933955890010111, | |
0.9595873641083017, | |
0.9222068400122225, | |
0.9303905110573396]]], | |
["vm1_ivar_set", | |
[[1.0100207289215177, | |
0.9490665280027315, | |
0.940879620029591, | |
0.9348470020340756, | |
1.0969619620591402], | |
[0.9733142430195585, | |
0.9965538509422913, | |
0.9328566050389782, | |
0.9386856540804729, | |
0.9445662290090695]]], | |
["vm1_length", | |
[[1.2175306610297412, | |
1.2118691129144281, | |
1.244486027979292, | |
1.170522646047175, | |
1.1583953999215737], | |
[1.2801110820146278, | |
1.1823380690766498, | |
1.2047874119598418, | |
1.1686808429658413, | |
1.1911647350061685]]], | |
["vm1_lvar_init", | |
[[2.1999385319650173, | |
2.2071183719672263, | |
2.3052751310169697, | |
2.4191457720007747, | |
2.3370251399464905], | |
[2.039467212976888, | |
2.2144007469760254, | |
1.9835393260000274, | |
2.0068190899910405, | |
2.164110332960263]]], | |
["vm1_lvar_set", | |
[[3.256971818045713, | |
3.2059226050041616, | |
3.2343228210229427, | |
3.2001832550158724, | |
3.2589813239173964], | |
[3.1277232139836997, | |
3.1559996819123626, | |
3.183988763950765, | |
3.1363863369915634, | |
3.053303731023334]]], | |
["vm1_neq", | |
[[1.2878046439727768, | |
1.3137129640672356, | |
1.3088577809976414, | |
1.292765369056724, | |
1.2345328869996592], | |
[1.2941599630285054, | |
1.2622110019437969, | |
1.2626920159673318, | |
1.3932315480196849, | |
1.313475435017608]]], | |
["vm1_not", | |
[[1.0429368420736864, | |
1.022667674929835, | |
1.0024491749936715, | |
1.0336345180403441, | |
1.018504393985495], | |
[1.0037973059806973, | |
0.9977195999817923, | |
0.9823493961011991, | |
0.9571478849975392, | |
1.0139474710449576]]], | |
["vm1_rescue", | |
[[0.8484178560320288, | |
0.8812193790217862, | |
0.8280623060418293, | |
0.8443494009552523, | |
0.8195043129380792], | |
[0.7790486529702321, | |
0.7816934599541128, | |
0.7920452429680154, | |
0.8032334269955754, | |
0.8415183509932831]]], | |
["vm1_simplereturn", | |
[[1.4098546450259164, | |
1.4011824259068817, | |
1.3476103310240433, | |
1.4199581819120795, | |
1.3929492770694196], | |
[1.291701184003614, | |
1.3379355550277978, | |
1.3694995699916035, | |
1.3547811899334192, | |
1.3476812770823017]]], | |
["vm1_swap", | |
[[0.9882256770506501, | |
0.9617749890312552, | |
0.9844363369047642, | |
0.9844670949969441, | |
0.9851212380453944], | |
[0.9672923469915986, | |
0.9713920570211485, | |
0.9688850929960608, | |
0.961939447093755, | |
0.945147947059013]]], | |
["vm1_yield", | |
[[1.5301956719486043, | |
1.5524513619020581, | |
1.535960379987955, | |
1.5487538470188156, | |
1.532978364964947], | |
[1.3853197180433199, | |
1.3767576909158379, | |
1.45196552190464, | |
1.3847791280131787, | |
1.3985177259892225]]], | |
["vm2_array", | |
[[0.9864808169659227, | |
0.9424049269873649, | |
0.9470406629843637, | |
0.947011454962194, | |
0.9521666320506483], | |
[0.9340404389658943, | |
0.9500445630401373, | |
0.8731430990155786, | |
0.9165771009866148, | |
0.8695507129887119]]], | |
["vm2_bigarray", | |
[[10.2267295520287, | |
9.561489130021073, | |
10.090644246898592, | |
10.081709917983972, | |
10.075742300017737], | |
[9.472753201960586, | |
9.467810433008708, | |
9.441162261995487, | |
9.294025932089426, | |
9.455035869963467]]], | |
["vm2_bighash", | |
[[4.359866971964948, | |
4.196486475062557, | |
4.278961407020688, | |
4.328070296091028, | |
4.210509800934233], | |
[4.050221433979459, | |
4.044077206985094, | |
4.032773734070361, | |
4.100809400086291, | |
4.102739860070869]]], | |
["vm2_case", | |
[[0.2619465009775013, | |
0.2838237399701029, | |
0.28194263100158423, | |
0.26048463792540133, | |
0.2488515069708228], | |
[0.22200593899469823, | |
0.24976177606731653, | |
0.23845415096729994, | |
0.2544713739771396, | |
0.23091391392517835]]], | |
["vm2_case_lit", | |
[[0.8754943540552631, | |
0.9623493229737505, | |
0.8772008740343153, | |
0.8502874290570617, | |
0.878177392994985], | |
[0.8820248820120469, | |
0.8694034670479596, | |
0.8623934079660103, | |
0.8866133840056136, | |
0.9067962359404191]]], | |
["vm2_defined_method", | |
[[3.0769560820190236, | |
2.94910455995705, | |
2.9971248959191144, | |
2.9844176850747317, | |
3.0369281029561535], | |
[3.5950162559747696, | |
3.530674858018756, | |
3.5434669690439478, | |
3.660136030986905, | |
3.555109731038101]]], | |
["vm2_dstr", | |
[[1.1376889569219202, | |
1.1790524049429223, | |
1.1705649680225179, | |
1.1717189019545913, | |
1.178114204085432], | |
[1.194065082934685, | |
1.1828249279642478, | |
1.1808544259984046, | |
1.2567875509848818, | |
1.3292802079813555]]], | |
["vm2_eval", | |
[[22.748127643950284, | |
22.279592863982543, | |
22.21301919000689, | |
23.91950308997184, | |
22.592453115037642], | |
[22.470529740909114, | |
22.542434667004272, | |
22.369654320064, | |
22.324487831094302, | |
22.234362442977726]]], | |
["vm2_method", | |
[[1.279581852024421, | |
1.2871431020321324, | |
1.2596520120278, | |
1.3235943879699335, | |
1.4536260040476918], | |
[1.2885518729453906, | |
1.2857341149356216, | |
1.3142342009814456, | |
1.2660287170438096, | |
1.2564591499976814]]], | |
["vm2_method_missing", | |
[[2.8666849200380966, | |
2.909256412065588, | |
2.7894520999398082, | |
2.8363070489140227, | |
2.8184968259884045], | |
[2.852661070995964, | |
2.917175633017905, | |
3.059407752007246, | |
2.8628767759073526, | |
2.897778737009503]]], | |
["vm2_method_with_block", | |
[[1.3699430170236155, | |
1.38195694796741, | |
1.3769991729641333, | |
1.364738714066334, | |
1.3902382090454921], | |
[1.4707032139413059, | |
1.3853221370372921, | |
1.4449089680565521, | |
1.3887808859581128, | |
1.398828632896766]]], | |
["vm2_mutex", | |
[[0.8668883019126952, | |
0.8786476789973676, | |
0.8934233809122816, | |
0.8874565199948847, | |
0.8399143670685589], | |
[0.9818649550434202, | |
0.8836689819581807, | |
0.9677371230209246, | |
0.988495300989598, | |
0.9366747270105407]]], | |
["vm2_newlambda", | |
[[0.9959138419944793, | |
1.0006342570995912, | |
1.0061358049279079, | |
1.1668292969698086, | |
1.0103186609921977], | |
[0.9846504109445959, | |
1.0045254629803821, | |
1.029782057972625, | |
1.0084058369975537, | |
0.9647894209483638]]], | |
["vm2_poly_method", | |
[[3.0255783010507002, | |
3.019156118039973, | |
3.0477078839903697, | |
2.976079158950597, | |
3.0265013909665868], | |
[3.110283198999241, | |
3.346966362092644, | |
3.1246633320115507, | |
3.189704268006608, | |
3.2260494510410354]]], | |
["vm2_poly_method_ov", | |
[[0.37027859897352755, | |
0.35654415807221085, | |
0.34592776000499725, | |
0.3836190359434113, | |
0.38584208802785724], | |
[0.3884468119358644, | |
0.383586265030317, | |
0.3898650569608435, | |
0.3500508249271661, | |
0.4463722149375826]]], | |
["vm2_proc", | |
[[0.6089216130785644, | |
0.6150774590205401, | |
0.5714327949099243, | |
0.5753663349896669, | |
0.605134749901481], | |
[0.6111840310040861, | |
0.6757885330589488, | |
0.8651169380173087, | |
0.6847723949467763, | |
0.7148988990811631]]], | |
["vm2_raise1", | |
[[4.949372387956828, | |
4.930352870025672, | |
5.002072151983157, | |
5.15390663407743, | |
5.110922234016471], | |
[4.8909971109824255, | |
5.349751180969179, | |
4.857086256030016, | |
4.896873041987419, | |
4.865523607004434]]], | |
["vm2_raise2", | |
[[7.961383535992354, | |
7.700990153010935, | |
7.693204144947231, | |
7.590272767934948, | |
8.095175190013833], | |
[8.365565062966198, | |
7.621092822984792, | |
7.537460542982444, | |
7.515401293989271, | |
7.818980882992037]]], | |
["vm2_regexp", | |
[[1.313094164012, | |
1.3076641110237688, | |
1.284106100909412, | |
1.2731323440093547, | |
1.3697610169183463], | |
[1.3594907260267064, | |
1.3301157349487767, | |
1.3270998559892178, | |
1.3712411399465054, | |
1.3077540330123156]]], | |
["vm2_send", | |
[[0.5251989060780033, | |
0.5592143470421433, | |
0.5400359339546412, | |
0.554872908978723, | |
0.5532119689742103], | |
[0.5127090490423143, | |
0.4954036179697141, | |
0.5297531269025058, | |
0.48911669908557087, | |
0.49407414498273283]]], | |
["vm2_string_literal", | |
[[0.34665385994594544, | |
0.3084796310868114, | |
0.3089321069419384, | |
0.35174350009765476, | |
0.3032875310163945], | |
[0.3556818841025233, | |
0.2998379539931193, | |
0.31570481101516634, | |
0.30457645596470684, | |
0.4108817789237946]]], | |
["vm2_struct_big_aref_hi", | |
[[0.29838010808452964, | |
0.33999655896332115, | |
0.2895501629682258, | |
0.36539423803333193, | |
0.3381085699656978], | |
[0.3170730860438198, | |
0.3529772129841149, | |
0.32895411003846675, | |
0.3511206950061023, | |
0.35723876499105245]]], | |
["vm2_struct_big_aref_lo", | |
[[0.3578531319508329, | |
0.3488863449310884, | |
0.3420171879697591, | |
0.3262544310418889, | |
0.3288663380080834], | |
[0.345018635969609, | |
0.32875688397325575, | |
0.32560366904363036, | |
0.3065255139954388, | |
0.3391150269890204]]], | |
["vm2_struct_big_aset", | |
[[0.35130606906022877, | |
0.34029660501983017, | |
0.381685986998491, | |
0.36959810298867524, | |
0.3740865809377283], | |
[0.340481230057776, | |
0.3381426509004086, | |
0.3274879159871489, | |
0.34081885404884815, | |
0.3785911339800805]]], | |
["vm2_struct_big_href_hi", | |
[[0.4190911279292777, | |
0.42406872590072453, | |
0.41353046894073486, | |
0.41544463811442256, | |
0.4155788030475378], | |
[0.4165720799937844, | |
0.40637945500202477, | |
0.41635459498502314, | |
0.4204686189768836, | |
0.42917738296091557]]], | |
["vm2_struct_big_href_lo", | |
[[0.44617557199671865, | |
0.445432584034279, | |
0.43015890708193183, | |
0.40709071001037955, | |
0.41904770594555885], | |
[0.4057509789709002, | |
0.460414853063412, | |
0.4180753390537575, | |
0.47328460204880685, | |
0.4184348500566557]]], | |
["vm2_struct_big_hset", | |
[[0.487609860021621, | |
0.4508612819481641, | |
0.43037575692869723, | |
0.5681768209906295, | |
0.4323477760190144], | |
[0.470006944029592, | |
0.4423326689284295, | |
0.4830686500063166, | |
0.474012637976557, | |
0.47723563096951693]]], | |
["vm2_struct_small_aref", | |
[[0.2793347289552912, | |
0.2683165540220216, | |
0.2599930359283462, | |
0.285065709031187, | |
0.287401802954264], | |
[0.2827676460146904, | |
0.27835497504565865, | |
0.27271448296960443, | |
0.2571972069563344, | |
0.24549310200382024]]], | |
["vm2_struct_small_aset", | |
[[0.3804985269671306, | |
0.33701021398883313, | |
0.39011341496370733, | |
0.37686154700350016, | |
0.3804389520082623], | |
[0.3961359430104494, | |
0.3564011319540441, | |
0.3929391399724409, | |
0.34539266594219953, | |
0.3897257260978222]]], | |
["vm2_struct_small_href", | |
[[0.4164629700826481, | |
0.3984802990453318, | |
0.38632836809847504, | |
0.42341673094779253, | |
0.4092459019739181], | |
[0.4152171609457582, | |
0.3967451610369608, | |
0.42848581192083657, | |
0.39535745105240494, | |
0.3965323610464111]]], | |
["vm2_struct_small_hset", | |
[[0.43300800200086087, | |
0.405840030987747, | |
0.4531787510495633, | |
0.4087796399835497, | |
0.4644759549992159], | |
[0.4106982230441645, | |
0.39889710606075823, | |
0.43375748803373426, | |
0.4505690740188584, | |
0.40594870899803936]]], | |
["vm2_super", | |
[[0.6853680980857462, | |
0.6480090329423547, | |
0.6558889020234346, | |
0.6130874570226297, | |
0.6504613989964128], | |
[0.6532956860028207, | |
0.6142148280050606, | |
0.6578682699473575, | |
0.6314947049831972, | |
0.6492877890123054]]], | |
["vm2_unif1", | |
[[0.3416488509392366, | |
0.33805370808113366, | |
0.3328374980483204, | |
0.3228982100263238, | |
0.30499062000308186], | |
[0.33373622095678, | |
0.33399873110465705, | |
0.2857946150470525, | |
0.31229540798813105, | |
0.29617300594691187]]], | |
["vm2_zsuper", | |
[[0.6209678670857102, | |
0.7618362620705739, | |
0.6641745280940086, | |
0.6568355089984834, | |
0.6310161630390212], | |
[0.6303672679932788, | |
0.6978552798973396, | |
0.742036669049412, | |
0.6332919799024239, | |
0.6678852620534599]]], | |
["vm3_backtrace", | |
[[0.22997413796838373, | |
0.21112273400649428, | |
0.20754643296822906, | |
0.16854821401648223, | |
0.1783876350382343], | |
[0.1717047441052273, | |
0.1716264869319275, | |
0.2154318660032004, | |
0.21559781802352518, | |
0.18539561098441482]]], | |
["vm3_clearmethodcache", | |
[[0.3233399869641289, | |
0.31931639509275556, | |
0.3420628639869392, | |
0.3548121979692951, | |
0.3342083210591227], | |
[0.32320575998164713, | |
0.3145827710395679, | |
0.3596599540906027, | |
0.3922513120342046, | |
0.34864867897704244]]], | |
["vm3_gc", | |
[[1.4565825049066916, | |
1.6127909700153396, | |
1.4874821739504114, | |
1.4508209599880502, | |
1.4720979740377516], | |
[1.4138594950782135, | |
1.4817460509948432, | |
1.4232179239625111, | |
1.3768265180988237, | |
1.3733354229480028]]], | |
["vm3_gc_old_full", | |
[[3.3804282639175653, | |
3.360886448994279, | |
3.3795669618993998, | |
3.3059421150246635, | |
3.293723420938477], | |
[3.3484380450099707, | |
3.377359615988098, | |
3.3181581719545648, | |
3.3055209149606526, | |
3.2479409070219845]]], | |
["vm3_gc_old_immediate", | |
[[2.809362306026742, | |
2.8465095019200817, | |
3.0078539120731875, | |
3.027784492005594, | |
3.000528441974893], | |
[2.8972228970378637, | |
3.1001153270481154, | |
3.061605235096067, | |
2.906369192060083, | |
3.050990574993193]]], | |
["vm3_gc_old_lazy", | |
[[3.906487589934841, | |
4.134856679942459, | |
3.8369784200331196, | |
3.7586515470175073, | |
3.967423382913694], | |
[3.8638424179516733, | |
4.083651466993615, | |
3.778044708073139, | |
4.115537403034978, | |
3.824456701055169]]], | |
["vm_symbol_block_pass", | |
[[1.1257652869680896, | |
1.1856958860298619, | |
1.0764278889400885, | |
1.1576168929459527, | |
1.1552929839817807], | |
[1.1283993049291894, | |
1.1149126599775627, | |
1.1423722270410508, | |
1.1790088919224218, | |
1.0886345269391313]]], | |
["vm_thread_alive_check1", | |
[[0.250905264983885, | |
0.2244327290682122, | |
0.20746608497574925, | |
0.18340853101108223, | |
0.21054480504244566], | |
[0.21525695291347802, | |
0.2222082270309329, | |
0.21031203493475914, | |
0.21567859209608287, | |
0.23049798200372607]]], | |
["vm_thread_close", | |
[[5.6472671129740775, | |
6.07868930301629, | |
5.899174139020033, | |
5.846925333025865, | |
6.39158919500187], | |
[5.62468595802784, | |
5.691013601026498, | |
4.814508448005654, | |
5.904351843055338, | |
4.552630113903433]]], | |
["vm_thread_create_join", | |
[[4.5239056260325015, | |
4.411398481926881, | |
4.215117954998277, | |
4.363031704095192, | |
4.347520570969209], | |
[4.337680438999087, | |
4.535930744954385, | |
4.1838729929877445, | |
4.380066936952062, | |
4.4904781189979985]]], | |
["vm_thread_mutex1", | |
[[0.6662177360849455, | |
0.6705055671045557, | |
0.6909727910533547, | |
0.6474885119823739, | |
0.6326415820512921], | |
[0.649574670009315, | |
0.6786495490232483, | |
0.6666031350614503, | |
0.7354894110467285, | |
0.6377919759834185]]], | |
["vm_thread_mutex2", | |
[[1.1216140550095588, | |
1.495425326982513, | |
2.6953884069807827, | |
2.1321476340526715, | |
1.7086537859868258], | |
[1.9019261099165305, | |
1.622454366995953, | |
2.3639166170032695, | |
2.0896611040225253, | |
2.2645893619628623]]], | |
["vm_thread_mutex3", | |
[[27.397930574021302, | |
23.5423261069227, | |
25.471124968025833, | |
19.435467693023384, | |
8.593432280002162], | |
[20.13779211998917, | |
22.57824261195492, | |
28.509413485066034, | |
30.53807972604409, | |
27.98444297106471]]], | |
["vm_thread_pass", | |
[[0.32933060301002115, | |
0.36675145104527473, | |
0.34230901196133345, | |
0.3963512961054221, | |
0.3537983709247783], | |
[0.40798689099028707, | |
0.37036699790041894, | |
0.42855509906075895, | |
0.4345944150118157, | |
0.3863320150412619]]], | |
["vm_thread_pass_flood", | |
[[0.1561750159598887, | |
0.25159286498092115, | |
0.14752352493815124, | |
0.22476911207195371, | |
0.1402553409570828], | |
[0.10077841905876994, | |
0.09581942507065833, | |
0.14532443694770336, | |
0.24667707702610642, | |
0.13841347699053586]]], | |
["vm_thread_pipe", | |
[[0.2924502049572766, | |
0.3836949690012261, | |
0.33484510995913297, | |
0.30142869404517114, | |
0.31491148797795177], | |
[0.37183289998210967, | |
0.28924837394151837, | |
0.3221808939706534, | |
0.2940054330974817, | |
0.26863185898400843]]], | |
["vm_thread_queue", | |
[[0.16626917908433825, | |
0.15921901795081794, | |
0.19360081700142473, | |
0.19142317795194685, | |
0.15079771599266678], | |
[0.19283601292409003, | |
0.2019919849699363, | |
0.21107392001431435, | |
0.18322816700674593, | |
0.16120479395613074]]]] | |
Elapsed time: 4122.482286171 (sec) | |
----------------------------------------------------------- | |
benchmark results: | |
minimum results in each 5 measurements. | |
Execution time (sec) | |
name ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] built-ruby | |
app_answer 0.044 0.048 | |
app_aobench 54.586 50.302 | |
app_erb 2.214 2.297 | |
app_factorial 0.804 0.798 | |
app_fib 0.528 0.493 | |
app_lc_fizzbuzz 68.594 40.992 | |
app_mandelbrot 1.414 1.393 | |
app_pentomino 16.955 17.549 | |
app_raise 0.240 0.214 | |
app_strconcat 1.068 1.072 | |
app_tak 0.718 0.738 | |
app_tarai 0.600 0.612 | |
app_uri 0.592 0.565 | |
array_shift 19.361 18.368 | |
hash_aref_dsym 0.362 0.391 | |
hash_aref_dsym_long 8.651 8.881 | |
hash_aref_fix 0.365 0.400 | |
hash_aref_flo 0.077 0.079 | |
hash_aref_miss 0.481 0.506 | |
hash_aref_str 0.450 0.510 | |
hash_aref_sym 0.352 0.351 | |
hash_aref_sym_long 0.541 0.521 | |
hash_flatten 0.307 0.325 | |
hash_ident_flo 0.041 0.045 | |
hash_ident_num 0.365 0.344 | |
hash_ident_obj 0.356 0.356 | |
hash_ident_str 0.344 0.363 | |
hash_ident_sym 0.368 0.356 | |
hash_keys 0.362 0.366 | |
hash_shift 0.020 0.019 | |
hash_shift_u16 0.092 0.092 | |
hash_shift_u24 0.093 0.095 | |
hash_shift_u32 0.088 0.094 | |
hash_to_proc 0.016 0.010 | |
hash_values 0.343 0.347 | |
io_file_create 1.070 1.104 | |
io_file_read 1.397 1.421 | |
io_file_write 0.551 0.546 | |
io_nonblock_noex 0.000 0.000 | |
io_nonblock_noex2 0.000 0.000 | |
io_select 1.328 1.391 | |
io_select2 1.642 1.658 | |
io_select3 0.080 0.079 | |
loop_for 1.337 1.396 | |
loop_generator 0.414 0.381 | |
loop_times 1.243 1.249 | |
loop_whileloop 0.655 0.659 | |
loop_whileloop2 0.135 0.139 | |
marshal_dump_flo 0.393 0.426 | |
marshal_dump_load_geniv 0.611 0.589 | |
marshal_dump_load_time 1.688 1.742 | |
require 0.880 0.851 | |
require_thread 0.217 0.123 | |
securerandom 0.256 0.243 | |
so_ackermann 0.616 0.563 | |
so_array 0.921 0.900 | |
so_binary_trees 6.237 5.984 | |
so_concatenate 4.001 4.215 | |
so_count_words 0.161 0.149 | |
so_exception 0.295 0.280 | |
so_fannkuch 1.173 1.188 | |
so_fasta 2.025 1.942 | |
so_k_nucleotide 1.292 1.258 | |
so_lists 0.558 0.537 | |
so_mandelbrot 2.668 2.579 | |
so_matrix 0.539 0.548 | |
so_meteor_contest 3.110 3.163 | |
so_nbody 1.432 1.463 | |
so_nested_loop 1.139 1.142 | |
so_nsieve 2.642 2.617 | |
so_nsieve_bits 2.268 2.343 | |
so_object 0.690 0.696 | |
so_partial_sums 2.501 2.299 | |
so_pidigits 1.082 1.074 | |
so_random 0.608 0.595 | |
so_reverse_complement 1.402 1.415 | |
so_sieve 0.633 0.595 | |
so_spectralnorm 1.969 1.962 | |
vm1_attr_ivar* 0.718 0.696 | |
vm1_attr_ivar_set* 0.884 0.823 | |
vm1_block* 1.541 1.399 | |
vm1_const* 0.329 0.294 | |
vm1_ensure* 0.007 0.000 | |
vm1_float_simple* 4.381 4.179 | |
vm1_gc_short_lived* 4.831 5.113 | |
vm1_gc_short_with_complex_long* 6.124 6.320 | |
vm1_gc_short_with_long* 6.207 6.632 | |
vm1_gc_short_with_symbol* 4.713 4.954 | |
vm1_gc_wb_ary* 0.656 0.633 | |
vm1_gc_wb_ary_promoted* 0.701 0.696 | |
vm1_gc_wb_obj* 0.445 0.488 | |
vm1_gc_wb_obj_promoted* 0.488 0.488 | |
vm1_ivar* 0.253 0.263 | |
vm1_ivar_set* 0.280 0.273 | |
vm1_length* 0.504 0.509 | |
vm1_lvar_init* 1.545 1.324 | |
vm1_lvar_set* 2.546 2.394 | |
vm1_neq* 0.580 0.603 | |
vm1_not* 0.348 0.298 | |
vm1_rescue* 0.165 0.120 | |
vm1_simplereturn* 0.693 0.632 | |
vm1_swap* 0.307 0.286 | |
vm1_yield* 0.876 0.717 | |
vm2_array* 0.808 0.731 | |
vm2_bigarray* 9.427 9.155 | |
vm2_bighash* 4.062 3.894 | |
vm2_case* 0.114 0.083 | |
vm2_case_lit* 0.716 0.723 | |
vm2_defined_method* 2.815 3.392 | |
vm2_dstr* 1.003 1.042 | |
vm2_eval* 22.078 22.095 | |
vm2_method* 1.125 1.117 | |
vm2_method_missing* 2.655 2.714 | |
vm2_method_with_block* 1.230 1.246 | |
vm2_mutex* 0.705 0.745 | |
vm2_newlambda* 0.861 0.826 | |
vm2_poly_method* 2.841 2.971 | |
vm2_poly_method_ov* 0.211 0.211 | |
vm2_proc* 0.437 0.472 | |
vm2_raise1* 4.796 4.718 | |
vm2_raise2* 7.456 7.376 | |
vm2_regexp* 1.139 1.169 | |
vm2_send* 0.391 0.350 | |
vm2_string_literal* 0.169 0.161 | |
vm2_struct_big_aref_hi* 0.155 0.178 | |
vm2_struct_big_aref_lo* 0.192 0.167 | |
vm2_struct_big_aset* 0.206 0.188 | |
vm2_struct_big_href_hi* 0.279 0.267 | |
vm2_struct_big_href_lo* 0.273 0.267 | |
vm2_struct_big_hset* 0.296 0.303 | |
vm2_struct_small_aref* 0.125 0.106 | |
vm2_struct_small_aset* 0.202 0.206 | |
vm2_struct_small_href* 0.252 0.256 | |
vm2_struct_small_hset* 0.271 0.260 | |
vm2_super* 0.478 0.475 | |
vm2_unif1* 0.170 0.147 | |
vm2_zsuper* 0.486 0.491 | |
vm3_backtrace 0.169 0.172 | |
vm3_clearmethodcache 0.319 0.315 | |
vm3_gc 1.451 1.373 | |
vm3_gc_old_full 3.294 3.248 | |
vm3_gc_old_immediate 2.809 2.897 | |
vm3_gc_old_lazy 3.759 3.778 | |
vm_symbol_block_pass 1.076 1.089 | |
vm_thread_alive_check1 0.183 0.210 | |
vm_thread_close 5.647 4.553 | |
vm_thread_create_join 4.215 4.184 | |
vm_thread_mutex1 0.633 0.638 | |
vm_thread_mutex2 1.122 1.622 | |
vm_thread_mutex3 8.593 20.138 | |
vm_thread_pass 0.329 0.370 | |
vm_thread_pass_flood 0.140 0.096 | |
vm_thread_pipe 0.292 0.269 | |
vm_thread_queue 0.151 0.161 | |
Speedup ratio: compare with the result of `ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux]' (greater is better) | |
name built-ruby | |
app_answer 0.914 | |
app_aobench 1.085 | |
app_erb 0.964 | |
app_factorial 1.007 | |
app_fib 1.072 | |
app_lc_fizzbuzz 1.673 | |
app_mandelbrot 1.015 | |
app_pentomino 0.966 | |
app_raise 1.122 | |
app_strconcat 0.996 | |
app_tak 0.973 | |
app_tarai 0.981 | |
app_uri 1.048 | |
array_shift 1.054 | |
hash_aref_dsym 0.926 | |
hash_aref_dsym_long 0.974 | |
hash_aref_fix 0.913 | |
hash_aref_flo 0.976 | |
hash_aref_miss 0.951 | |
hash_aref_str 0.881 | |
hash_aref_sym 1.002 | |
hash_aref_sym_long 1.040 | |
hash_flatten 0.945 | |
hash_ident_flo 0.922 | |
hash_ident_num 1.061 | |
hash_ident_obj 1.001 | |
hash_ident_str 0.947 | |
hash_ident_sym 1.032 | |
hash_keys 0.988 | |
hash_shift 1.045 | |
hash_shift_u16 0.998 | |
hash_shift_u24 0.983 | |
hash_shift_u32 0.944 | |
hash_to_proc 1.557 | |
hash_values 0.988 | |
io_file_create 0.969 | |
io_file_read 0.983 | |
io_file_write 1.009 | |
io_nonblock_noexError | |
io_nonblock_noex2Error | |
io_select 0.955 | |
io_select2 0.990 | |
io_select3 1.022 | |
loop_for 0.958 | |
loop_generator 1.085 | |
loop_times 0.995 | |
loop_whileloop 0.993 | |
loop_whileloop2 0.968 | |
marshal_dump_flo 0.922 | |
marshal_dump_load_geniv 1.036 | |
marshal_dump_load_time 0.969 | |
require 1.034 | |
require_thread 1.767 | |
securerandom 1.053 | |
so_ackermann 1.094 | |
so_array 1.023 | |
so_binary_trees 1.042 | |
so_concatenate 0.949 | |
so_count_words 1.082 | |
so_exception 1.054 | |
so_fannkuch 0.987 | |
so_fasta 1.043 | |
so_k_nucleotide 1.027 | |
so_lists 1.040 | |
so_mandelbrot 1.035 | |
so_matrix 0.984 | |
so_meteor_contest 0.983 | |
so_nbody 0.979 | |
so_nested_loop 0.997 | |
so_nsieve 1.009 | |
so_nsieve_bits 0.968 | |
so_object 0.991 | |
so_partial_sums 1.088 | |
so_pidigits 1.007 | |
so_random 1.022 | |
so_reverse_complement 0.991 | |
so_sieve 1.063 | |
so_spectralnorm 1.004 | |
vm1_attr_ivar* 1.032 | |
vm1_attr_ivar_set* 1.074 | |
vm1_block* 1.101 | |
vm1_const* 1.118 | |
vm1_ensure*Error | |
vm1_float_simple* 1.048 | |
vm1_gc_short_lived* 0.945 | |
vm1_gc_short_with_complex_long* 0.969 | |
vm1_gc_short_with_long* 0.936 | |
vm1_gc_short_with_symbol* 0.951 | |
vm1_gc_wb_ary* 1.036 | |
vm1_gc_wb_ary_promoted* 1.008 | |
vm1_gc_wb_obj* 0.912 | |
vm1_gc_wb_obj_promoted* 1.000 | |
vm1_ivar* 0.963 | |
vm1_ivar_set* 1.025 | |
vm1_length* 0.989 | |
vm1_lvar_init* 1.167 | |
vm1_lvar_set* 1.063 | |
vm1_neq* 0.962 | |
vm1_not* 1.169 | |
vm1_rescue* 1.379 | |
vm1_simplereturn* 1.096 | |
vm1_swap* 1.075 | |
vm1_yield* 1.221 | |
vm2_array* 1.106 | |
vm2_bigarray* 1.030 | |
vm2_bighash* 1.043 | |
vm2_case* 1.377 | |
vm2_case_lit* 0.989 | |
vm2_defined_method* 0.830 | |
vm2_dstr* 0.963 | |
vm2_eval* 0.999 | |
vm2_method* 1.007 | |
vm2_method_missing* 0.978 | |
vm2_method_with_block* 0.987 | |
vm2_mutex* 0.947 | |
vm2_newlambda* 1.043 | |
vm2_poly_method* 0.956 | |
vm2_poly_method_ov* 1.002 | |
vm2_proc* 0.925 | |
vm2_raise1* 1.016 | |
vm2_raise2* 1.011 | |
vm2_regexp* 0.974 | |
vm2_send* 1.116 | |
vm2_string_literal* 1.049 | |
vm2_struct_big_aref_hi* 0.870 | |
vm2_struct_big_aref_lo* 1.144 | |
vm2_struct_big_aset* 1.092 | |
vm2_struct_big_href_hi* 1.043 | |
vm2_struct_big_href_lo* 1.022 | |
vm2_struct_big_hset* 0.975 | |
vm2_struct_small_aref* 1.178 | |
vm2_struct_small_aset* 0.981 | |
vm2_struct_small_href* 0.982 | |
vm2_struct_small_hset* 1.044 | |
vm2_super* 1.007 | |
vm2_unif1* 1.161 | |
vm2_zsuper* 0.990 | |
vm3_backtrace 0.982 | |
vm3_clearmethodcache 1.015 | |
vm3_gc 1.056 | |
vm3_gc_old_full 1.014 | |
vm3_gc_old_immediate 0.970 | |
vm3_gc_old_lazy 0.995 | |
vm_symbol_block_pass 0.989 | |
vm_thread_alive_check1 0.872 | |
vm_thread_close 1.240 | |
vm_thread_create_join 1.007 | |
vm_thread_mutex1 0.992 | |
vm_thread_mutex2 0.691 | |
vm_thread_mutex3 0.427 | |
vm_thread_pass 0.889 | |
vm_thread_pass_flood 1.464 | |
vm_thread_pipe 1.089 | |
vm_thread_queue 0.935 | |
Log file: bmlog-20160912-070210.28768.tsv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment