From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: benchmarks on Intel(R) Xeon(R) CPU E3-1230 v3 @ 3.30GHz
Date: Mon, 22 Sep 2014 18:46:45 +0000 [thread overview]
Message-ID: <st-ccan-list-bench@meltdown> (raw)
In-Reply-To: <1411411308-24223-1-git-send-email-e@80x24.org>
2014-09-22 05:38:59 +0000
target 0: orig (ruby 2.2.0dev (2014-09-22 trunk 47681) [x86_64-linux]) at "b/ruby.orig"
target 1: stll (ruby 2.2.0dev (2014-09-22 trunk 47681) [x86_64-linux]) at "b/ruby"
-----------------------------------------------------------
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
orig 0.053822168
orig 0.054029033
orig 0.05420699
orig 0.05374481
orig 0.054266707
orig 0.053863589
orig 0.057185724
orig 0.05387
orig 0.053834501
orig 0.05408797
stll 0.054842263
stll 0.05406647
stll 0.054126083
stll 0.054508985
stll 0.055946202
stll 0.053851443
stll 0.054151559
stll 0.054021872
stll 0.054684883
stll 0.053992802
-----------------------------------------------------------
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 = -@p.vdot(@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)
# Subsmpling
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
orig 43.076738901
orig 43.028016045
orig 43.197667739
orig 44.312146415
orig 42.993375293
orig 43.096511663
orig 43.111997889
orig 43.14533459
orig 42.96419694
orig 43.581617607
stll 42.731068343
stll 42.91853553
stll 43.539508991
stll 46.036135327
stll 44.702937628
stll 43.279324603
stll 43.322062172
stll 46.042519525
stll 43.711278628
stll 44.468188102
-----------------------------------------------------------
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>
orig 0.877973788
orig 0.873433795
orig 0.937733265
orig 0.884718992
orig 0.87286147
orig 0.890507022
orig 0.873429153
orig 0.870941343
orig 0.874882247
orig 0.87176688
stll 0.872209629
stll 0.868533232
stll 0.872928831
stll 0.873147049
stll 0.867231466
stll 0.872875146
stll 0.874811633
stll 0.882248124
stll 0.873005187
stll 0.891447572
-----------------------------------------------------------
app_factorial
def fact(n)
if(n > 1)
n * fact(n-1)
else
1
end
end
100.times {
fact(5000)
}
orig 0.805401632
orig 0.806380912
orig 0.805792719
orig 0.806436317
orig 0.808000536
orig 0.804695953
orig 0.804775601
orig 0.808004935
orig 0.808079104
orig 0.806497236
stll 0.752931959
stll 0.75402637
stll 0.752723328
stll 0.75777318
stll 0.752127311
stll 0.752263454
stll 0.755094515
stll 0.754753176
stll 0.753876487
stll 0.757509723
-----------------------------------------------------------
app_fib
def fib n
if n < 3
1
else
fib(n-1) + fib(n-2)
end
end
fib(34)
orig 0.477865003
orig 0.499373551
orig 0.479733716
orig 0.480720254
orig 0.4740355
orig 0.480593195
orig 0.475646497
orig 0.481992312
orig 0.475438603
orig 0.591133305
stll 0.476690551
stll 0.479981071
stll 0.488814861
stll 0.506066234
stll 0.476148832
stll 0.477693471
stll 0.480147474
stll 0.475824736
stll 0.623956849
stll 0.502471049
-----------------------------------------------------------
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
orig 68.4564067
orig 69.127990261
orig 70.253889911
orig 67.784253118
orig 67.891071347
orig 66.856999744
orig 68.239627371
orig 68.355507495
orig 65.787745599
orig 66.527444796
stll 69.579906637
stll 67.215046349
stll 66.969033824
stll 65.271179722
stll 65.783239733
stll 69.280211269
stll 66.660859374
stll 66.130403877
stll 64.967371958
stll 63.875867786
-----------------------------------------------------------
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)
}
}
orig 1.459894239
orig 1.489491642
orig 0.902506879
orig 0.903327177
orig 0.898419648
orig 0.899715521
orig 0.898631131
orig 0.900987302
orig 0.901816105
orig 0.907537929
stll 0.89145598
stll 0.890685262
stll 0.906450235
stll 0.896532126
stll 0.892681072
stll 0.890940665
stll 0.899069383
stll 1.08214218
stll 0.910197243
stll 0.89143809
-----------------------------------------------------------
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)
orig 13.538910944
orig 13.649177685
orig 13.449619533
orig 13.874335848
orig 13.704765446
orig 13.940837522
orig 14.643880507
orig 13.702187804
orig 13.56631364
orig 13.460903579
stll 13.960857016
stll 14.283383114
stll 13.892281614
stll 13.792446335
stll 13.585338039
stll 14.079598714
stll 13.541945066
stll 13.555718528
stll 13.688990303
stll 13.653538944
-----------------------------------------------------------
app_raise
i = 0
while i<300000
i += 1
begin
raise
rescue
end
end
orig 0.256718303
orig 0.256379292
orig 0.260501366
orig 0.256184826
orig 0.256770062
orig 0.259899614
orig 0.25704115
orig 0.255111165
orig 0.263036359
orig 0.254985853
stll 0.255509678
stll 0.256840589
stll 0.261421628
stll 0.258192571
stll 0.25849846
stll 0.258302149
stll 0.255546399
stll 0.261529648
stll 0.259741815
stll 0.255793305
-----------------------------------------------------------
app_strconcat
i = 0
while i<2_000_000
"#{1+1} #{1+1} #{1+1}"
i += 1
end
orig 0.960328798
orig 0.977739962
orig 0.968757826
orig 0.966953146
orig 0.955175821
orig 0.968254937
orig 0.966052117
orig 0.957227335
orig 0.968715024
orig 0.955896901
stll 0.936486221
stll 0.932618274
stll 0.93241836
stll 0.958049731
stll 0.930236464
stll 0.93580221
stll 0.927296582
stll 0.930261898
stll 0.949535208
stll 0.997820343
-----------------------------------------------------------
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)
orig 0.751258597
orig 0.673566743
orig 0.673689533
orig 0.715104175
orig 0.66300676
orig 0.669495475
orig 0.805775253
orig 0.70083882
orig 0.705970981
orig 0.818605321
stll 0.663240028
stll 0.697075786
stll 0.699114141
stll 0.662322789
stll 0.662610921
stll 0.665765452
stll 0.67200912
stll 0.662522779
stll 0.683096156
stll 0.662753224
-----------------------------------------------------------
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)
orig 0.556255576
orig 0.553993818
orig 0.5601169
orig 0.558580523
orig 0.550725365
orig 0.568340898
orig 0.549644452
orig 0.567195744
orig 0.553216743
orig 0.55903324
stll 0.54721175
stll 0.546947964
stll 0.553037629
stll 0.547740836
stll 0.551975179
stll 0.555337569
stll 0.549248576
stll 0.553858963
stll 0.550279761
stll 0.553504042
-----------------------------------------------------------
app_uri
require 'uri'
100_000.times{
uri = URI.parse('http://www.ruby-lang.org')
uri.scheme
uri.host
uri.port
}
orig 0.678858713
orig 0.679524437
orig 0.70871908
orig 0.689013331
orig 0.683252542
orig 0.681265405
orig 0.687151738
orig 0.679977733
orig 0.679899615
orig 0.685387708
stll 0.663888328
stll 0.668038202
stll 0.674654907
stll 0.662838139
stll 0.670028513
stll 0.659243954
stll 0.667394447
stll 0.665213561
stll 0.669254498
stll 0.679531385
-----------------------------------------------------------
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] } }
orig 0.446768558
orig 0.441774664
orig 0.440020956
orig 0.419697422
orig 0.42437844
orig 0.435643711
orig 0.437852003
orig 0.436893765
orig 0.422652494
orig 0.418014289
stll 0.445995292
stll 0.449304373
stll 0.433700582
stll 0.474588809
stll 0.49473485
stll 0.46307417
stll 0.443920226
stll 0.45626427
stll 0.436658571
stll 0.450609853
-----------------------------------------------------------
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] } }
orig 0.429413779
orig 0.406133564
orig 0.413652752
orig 0.407510655
orig 0.432466956
orig 0.406426398
orig 0.65012434
orig 0.613034347
orig 0.404176082
orig 0.538524857
stll 0.405808621
stll 0.413312202
stll 0.401850785
stll 0.397737761
stll 0.396488459
stll 0.415100215
stll 0.408193783
stll 0.407542879
stll 0.406234235
stll 0.406430393
-----------------------------------------------------------
hash_aref_sym
h = {}
syms = ('a'..'z').to_a.map(&:to_sym)
syms.each { |s| h[s] = s }
200_000.times { syms.each { |s| h[s] } }
orig 0.615211082
orig 0.782243067
orig 0.781443557
orig 0.64885976
orig 0.715190894
orig 0.615359601
orig 0.607669017
orig 0.610745167
orig 0.616113301
orig 0.619308977
stll 0.619563668
stll 0.612723157
stll 0.611511672
stll 0.652681754
stll 0.698859367
stll 0.616637831
stll 0.618543489
stll 0.628100083
stll 0.634441625
stll 0.614356095
-----------------------------------------------------------
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?
].map!(&:to_sym)
syms.each { |s| h[s] = s }
200_000.times { syms.each { |s| h[s] } }
orig 1.374003318
orig 1.383922357
orig 1.369967781
orig 1.372910504
orig 1.375160122
orig 1.375002345
orig 1.378900439
orig 1.390391656
orig 1.381341628
orig 1.376968608
stll 1.397013071
stll 1.390732093
stll 1.650411114
stll 1.397701355
stll 1.450352241
stll 1.492276221
stll 1.398620443
stll 1.440458357
stll 1.412398528
stll 1.468146035
-----------------------------------------------------------
hash_flatten
h = {}
10000.times do |i|
h[i] = nil
end
1000.times do
h.flatten
end
orig 0.412321897
orig 0.40762904
orig 0.410505076
orig 0.411412774
orig 0.412726052
orig 0.409271151
orig 0.408371527
orig 0.411232503
orig 0.412040655
orig 0.417467342
stll 0.425944272
stll 0.419393809
stll 0.419178041
stll 0.422701223
stll 0.42640161
stll 0.431700433
stll 0.425823307
stll 0.428960291
stll 0.427122089
stll 0.421448606
-----------------------------------------------------------
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] } }
orig 0.295713337
orig 0.283685437
orig 0.284802222
orig 0.287065827
orig 0.285974218
orig 0.29045913
orig 0.287852136
orig 0.281939658
orig 0.302169303
orig 0.285425191
stll 0.283365793
stll 0.283044646
stll 0.283608866
stll 0.2947435
stll 0.282815534
stll 0.286135003
stll 0.284034278
stll 0.284348426
stll 0.282969689
stll 0.29209817
-----------------------------------------------------------
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] } }
orig 0.299977594
orig 0.28323321
orig 0.279770218
orig 0.288053726
orig 0.27808
orig 0.302275651
orig 0.282260369
orig 0.289452943
orig 0.290050327
orig 0.286439327
stll 0.281474478
stll 0.45254817
stll 0.284468923
stll 0.291538696
stll 0.307934031
stll 0.27969676
stll 0.282224447
stll 0.299456978
stll 0.288548865
stll 0.295508415
-----------------------------------------------------------
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] } }
orig 0.281492569
orig 0.279452627
orig 0.306886348
orig 0.293875706
orig 0.27767955
orig 0.282340644
orig 0.282513711
orig 0.277737484
orig 0.27840241
orig 0.306377801
stll 0.285180983
stll 0.286158359
stll 0.28488322
stll 0.2789034
stll 0.282665979
stll 0.310667206
stll 0.304831145
stll 0.304359489
stll 0.308089904
stll 0.304928809
-----------------------------------------------------------
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] } }
orig 0.305813012
orig 0.303189703
orig 0.301997459
orig 0.300660626
orig 0.300163474
orig 0.301810958
orig 0.298706863
orig 0.311960511
orig 0.320109957
orig 0.302986946
stll 0.32614618
stll 0.304887916
stll 0.315441648
stll 0.326258758
stll 0.324392301
stll 0.32748039
stll 0.325020528
stll 0.301887967
stll 0.302193528
stll 0.322104392
-----------------------------------------------------------
hash_keys
h = {}
10000.times do |i|
h[i] = nil
end
5000.times do
h.keys
end
orig 0.237521622
orig 0.23922897
orig 0.238281437
orig 0.238138736
orig 0.237818849
orig 0.2378655
orig 0.237608242
orig 0.238036116
orig 0.236039937
orig 0.235813287
stll 0.263477427
stll 0.258049086
stll 0.262820406
stll 0.258006327
stll 0.260327548
stll 0.258086656
stll 0.258101371
stll 0.261393187
stll 0.263826948
stll 0.263821759
-----------------------------------------------------------
hash_shift
h = {}
10000.times do |i|
h[i] = nil
end
50000.times do
k, v = h.shift
h[k] = v
end
orig 0.037325564
orig 0.037761812
orig 0.037403326
orig 0.036865859
orig 0.037000981
orig 0.037950627
orig 0.037680922
orig 0.037717904
orig 0.037626562
orig 0.036707708
stll 0.03798574
stll 0.037781371
stll 0.037426497
stll 0.037792447
stll 0.037706575
stll 0.037963926
stll 0.036547303
stll 0.037862104
stll 0.037668743
stll 0.037850759
-----------------------------------------------------------
hash_values
h = {}
10000.times do |i|
h[i] = nil
end
5000.times do
h.values
end
orig 0.248007122
orig 0.249332361
orig 0.249889164
orig 0.249408139
orig 0.249554509
orig 0.24780729
orig 0.248163849
orig 0.249284379
orig 0.255694909
orig 0.249493122
stll 0.255092865
stll 0.255601239
stll 0.258623913
stll 0.255917981
stll 0.254690221
stll 0.255258993
stll 0.259686026
stll 0.258781678
stll 0.25826431
stll 0.259851974
-----------------------------------------------------------
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)
orig 1.149395899
orig 1.111947451
orig 1.148424115
orig 1.123299421
orig 1.078547687
orig 1.098754876
orig 1.094469825
orig 1.115538889
orig 1.087441845
orig 1.093890361
stll 1.122687358
stll 1.134292887
stll 1.1001334
stll 1.10556303
stll 1.109311338
stll 1.117908214
stll 1.145130799
stll 1.112610468
stll 1.113446261
stll 1.104785981
-----------------------------------------------------------
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
}
orig 1.125019709
orig 1.13541136
orig 1.137872765
orig 1.134047156
orig 1.144845212
orig 1.129636485
orig 1.115561785
orig 1.137242899
orig 1.139068138
orig 1.162766904
stll 1.15143518
stll 1.127682375
stll 1.154615488
stll 1.116836046
stll 1.11798176
stll 1.151602558
stll 1.124061101
stll 1.144359065
stll 1.126918446
stll 1.180646534
-----------------------------------------------------------
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
}
orig 0.776067606
orig 0.797726835
orig 0.778702876
orig 0.787620677
orig 0.77398871
orig 0.776857011
orig 0.781660664
orig 0.801027151
orig 0.784763445
orig 0.784689316
stll 0.811236564
stll 0.880919813
stll 0.856910608
stll 0.803084827
stll 0.781769853
stll 0.780891689
stll 0.781802785
stll 0.786309619
stll 0.780036884
stll 0.809695371
-----------------------------------------------------------
io_select
# IO.select performance
w = [ IO.pipe[1] ];
nr = 1000000
nr.times {
IO.select nil, w
}
orig 1.44421145
orig 1.500961778
orig 1.340275243
orig 1.333589151
orig 1.343530587
orig 1.388690989
orig 1.330531973
orig 1.352735683
orig 1.331536008
orig 1.334436513
stll 1.326947365
stll 1.321638113
stll 1.40019153
stll 1.464163825
stll 1.35215768
stll 1.331160097
stll 1.325573937
stll 1.32871885
stll 1.394282438
stll 1.326135512
-----------------------------------------------------------
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
orig 1.484366617
orig 1.519561653
orig 1.49992768
orig 1.678054688
orig 1.478214104
orig 1.690015728
orig 1.736267968
orig 1.519632113
orig 1.484009967
orig 1.498426631
stll 1.477902349
stll 1.480356925
stll 1.510644959
stll 1.488792033
stll 1.491730639
stll 1.484534491
stll 1.474508188
stll 1.488224728
stll 1.479929293
stll 1.484428486
-----------------------------------------------------------
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
orig 0.035239068
orig 0.035185953
orig 0.035496549
orig 0.035138319
orig 0.035191802
orig 0.035105515
orig 0.035467736
orig 0.035069739
orig 0.035290586
orig 0.035655578
stll 0.035575096
stll 0.035514868
stll 0.035360184
stll 0.035532505
stll 0.035664328
stll 0.035364631
stll 0.035594935
stll 0.035676978
stll 0.035750193
stll 0.036109592
-----------------------------------------------------------
loop_for
for i in 1..30_000_000
#
end
orig 1.068398738
orig 1.089524688
orig 1.06515046
orig 1.076397493
orig 1.128322392
orig 1.056983289
orig 1.068786863
orig 1.06075239
orig 1.090364107
orig 1.05966495
stll 1.070177283
stll 1.199340781
stll 1.046856599
stll 1.228460821
stll 1.055218017
stll 1.081184898
stll 1.446706991
stll 1.075304924
stll 1.091709721
stll 1.047952522
-----------------------------------------------------------
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
orig 0.69687891
orig 0.66540424
orig 0.679628263
orig 0.679925684
orig 0.668787193
orig 0.663496081
orig 0.675394757
orig 0.668240526
orig 0.664183383
orig 0.668584543
stll 0.664589303
stll 0.664632547
stll 0.66494632
stll 0.66598414
stll 0.668229128
stll 0.703826444
stll 0.666750904
stll 0.696360115
stll 0.667385923
stll 0.664486322
-----------------------------------------------------------
loop_times
30_000_000.times{|e|}
orig 0.980117059
orig 0.99439093
orig 0.979838402
orig 0.980894064
orig 0.976447361
orig 1.017838667
orig 0.982484037
orig 0.975619088
orig 0.994094528
orig 0.975998638
stll 0.980488121
stll 1.012998277
stll 0.994445077
stll 1.021846043
stll 0.995144058
stll 0.980257679
stll 0.980164899
stll 0.982455737
stll 0.980923491
stll 0.995939417
-----------------------------------------------------------
loop_whileloop
i = 0
while i<30_000_000 # benchmark loop 1
i += 1
end
orig 0.519354884
orig 0.51248877
orig 0.528460095
orig 0.572378986
orig 0.522353833
orig 0.512769352
orig 0.51291327
orig 0.513174436
orig 0.512962627
orig 0.512993475
stll 0.512713733
stll 0.513168691
stll 0.513058356
stll 0.526820777
stll 0.597845519
stll 0.598345559
stll 0.513074299
stll 0.512725396
stll 0.512297872
stll 0.512275679
-----------------------------------------------------------
loop_whileloop2
i = 0
while i< 6_000_000 # benchmark loop 2
i += 1
end
orig 0.119143733
orig 0.119069969
orig 0.118170264
orig 0.119768966
orig 0.119649986
orig 0.119431425
orig 0.119271081
orig 0.117096695
orig 0.122974262
orig 0.119396226
stll 0.119527968
stll 0.119188292
stll 0.119380972
stll 0.119252149
stll 0.119249809
stll 0.119733445
stll 0.119868804
stll 0.119451459
stll 0.119356097
stll 0.11951881
-----------------------------------------------------------
securerandom
require "securerandom"
20_0000.times do
SecureRandom.random_number(100)
end
orig 0.648002646
orig 0.616914537
orig 0.643030421
orig 0.642372636
orig 0.626927428
orig 0.625634949
orig 0.626575619
orig 0.638432885
orig 0.635409301
orig 0.672691913
stll 0.621063098
stll 0.664200477
stll 0.628247305
stll 0.620684543
stll 0.623475494
stll 0.623570129
stll 0.621391886
stll 0.62354543
stll 0.615683188
stll 0.639126611
-----------------------------------------------------------
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)
orig 0.554878476
orig 0.55431934
orig 0.554912154
orig 0.554768344
orig 0.554965378
orig 0.555051582
orig 0.555390224
orig 0.561993
orig 0.554681063
orig 0.554925765
stll 0.555434009
stll 0.5543861
stll 0.555613879
stll 0.562025374
stll 0.567785032
stll 0.555452116
stll 0.554703316
stll 0.554925696
stll 0.554846137
stll 0.555057477
-----------------------------------------------------------
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}"
orig 0.716432331
orig 0.715614862
orig 0.718187026
orig 0.715615418
orig 0.716560232
orig 0.719680592
orig 0.716808351
orig 0.715400045
orig 0.717318291
orig 0.716128422
stll 0.722933867
stll 0.723459141
stll 1.01009105
stll 1.05958547
stll 0.723921387
stll 1.018041186
stll 0.820268848
stll 0.728892185
stll 0.728845082
stll 0.726623785
-----------------------------------------------------------
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
orig 5.891852595
orig 5.85857463
orig 5.886513007
orig 5.904337825
orig 6.007118055
orig 5.832122029
orig 5.817885089
orig 5.865527204
orig 6.11444961
orig 5.900852034
stll 5.841628543
stll 5.848832941
stll 5.842604198
stll 5.816352106
stll 5.914531149
stll 5.821454501
stll 5.864819026
stll 5.82034879
stll 5.78314775
stll 5.96197454
-----------------------------------------------------------
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
orig 3.145572464
orig 3.14750577
orig 3.152418716
orig 3.661567167
orig 3.183339491
orig 3.170945435
orig 3.388805977
orig 3.156055341
orig 3.357375794
orig 3.14938203
stll 3.131218652
stll 3.163337176
stll 3.204333685
stll 3.121685686
stll 3.129380278
stll 3.122056144
stll 3.124002248
stll 3.140635879
stll 3.220535497
stll 3.169139827
-----------------------------------------------------------
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}"
orig 0.242391291
orig 0.239844531
orig 0.239700652
orig 0.240641664
orig 0.240109531
orig 0.241933466
orig 0.239628769
orig 0.239354057
orig 0.240767827
orig 0.220111057
stll 0.197886702
stll 0.197439675
stll 0.197293019
stll 0.199392232
stll 0.198683854
stll 0.197303157
stll 0.197314665
stll 0.197404594
stll 0.19820777
stll 0.197466916
-----------------------------------------------------------
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
orig 0.27459704
orig 0.282408741
orig 0.279051681
orig 0.276141397
orig 0.279595338
orig 0.274870568
orig 0.286747379
orig 0.27522475
orig 0.29289278
orig 0.278606696
stll 0.296178192
stll 0.275072498
stll 0.27512703
stll 0.275032342
stll 0.275854473
stll 0.27558595
stll 0.273236387
stll 0.278263372
stll 0.280499338
stll 0.290462425
-----------------------------------------------------------
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)}"
orig 0.99656016
orig 0.997722458
orig 0.993261332
orig 1.012012197
orig 1.032322957
orig 0.998555259
orig 0.9905474
orig 0.98366331
orig 1.018624582
orig 1.027585325
stll 0.993587482
stll 1.029757339
stll 1.021017374
stll 0.997894093
stll 1.008250871
stll 1.012816448
stll 1.037534666
stll 1.006494168
stll 0.991196374
stll 1.051552952
-----------------------------------------------------------
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)
orig 1.626379653
orig 1.604243419
orig 1.608287118
orig 1.610960882
orig 1.619263969
orig 1.659891248
orig 1.606374795
orig 1.612020157
orig 1.667336899
orig 1.617827365
stll 1.861029118
stll 1.596523452
stll 1.605929241
stll 1.603162676
stll 1.617902462
stll 1.596778535
stll 1.747227256
stll 1.624631813
stll 1.596906256
stll 1.594713807
-----------------------------------------------------------
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) }
orig 1.004566888
orig 1.000403766
orig 1.013398124
orig 1.008655269
orig 1.004949563
orig 1.007553872
orig 1.00565489
orig 1.006228219
orig 0.999932032
orig 1.280733682
stll 1.006863257
stll 1.010804323
stll 1.006856365
stll 1.021802051
stll 1.002110227
stll 1.013540483
stll 1.007242235
stll 1.012412313
stll 1.008362609
stll 1.009553163
-----------------------------------------------------------
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
orig 0.4544042
orig 0.456157268
orig 0.46296676
orig 0.46579061
orig 0.455299073
orig 0.491072223
orig 0.457926713
orig 0.45763858
orig 0.45776412
orig 0.455454856
stll 0.456382284
stll 0.457859992
stll 0.456136711
stll 0.458060569
stll 0.456410862
stll 0.456431534
stll 0.457381009
stll 0.456965826
stll 0.45614831
stll 0.455747519
-----------------------------------------------------------
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
orig 1.979842828
orig 1.986014054
orig 2.023256356
orig 1.990052777
orig 2.004414585
orig 1.989482749
orig 2.00374384
orig 2.005260208
orig 1.973930571
orig 2.013561508
stll 1.983405369
stll 1.986018375
stll 1.981057158
stll 1.990895433
stll 1.998027297
stll 1.980012879
stll 2.000246329
stll 1.988311323
stll 2.068660796
stll 1.988520077
-----------------------------------------------------------
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]}"
orig 0.500874477
orig 0.484887281
orig 0.508492887
orig 0.49274288
orig 0.499600926
orig 0.533587423
orig 0.537606671
orig 0.494616717
orig 0.486548428
orig 0.487992105
stll 0.488608283
stll 0.492753145
stll 0.489930145
stll 0.492269239
stll 0.510433561
stll 0.490049011
stll 0.501774228
stll 0.509093734
stll 0.498486931
stll 0.491265322
-----------------------------------------------------------
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 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 acheived 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!!!
orig 2.64489358
orig 2.665539128
orig 2.620766875
orig 2.64559136
orig 2.667070644
orig 2.615702788
orig 2.634790016
orig 2.676334988
orig 2.629919232
orig 2.617883585
stll 2.643250652
stll 2.655673084
stll 2.689109941
stll 2.819435765
stll 2.656473882
stll 2.683216279
stll 2.725329669
stll 2.646512151
stll 2.651052236
stll 2.651709693
-----------------------------------------------------------
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)
orig 1.205101985
orig 1.213859787
orig 1.205128418
orig 1.391464894
orig 1.326758401
orig 1.199627727
orig 1.45721871
orig 1.208749139
orig 1.199151646
orig 1.200151241
stll 1.20549877
stll 1.237723323
stll 1.204646758
stll 1.199548993
stll 1.195648843
stll 1.198679314
stll 1.197062663
stll 1.210142232
stll 1.243288638
stll 1.319684736
-----------------------------------------------------------
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
orig 0.884004457
orig 0.905090802
orig 0.871943968
orig 0.870676388
orig 0.908360449
orig 0.932598348
orig 1.059668395
orig 1.26015312
orig 0.870940727
orig 0.885396989
stll 0.887870576
stll 1.171482791
stll 0.908446414
stll 0.88783285
stll 0.877407234
stll 0.92061022
stll 0.869538448
stll 0.896780013
stll 0.896127852
stll 0.875915198
-----------------------------------------------------------
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
orig 1.433350772
orig 1.422841423
orig 1.434855136
orig 1.422749093
orig 1.424615379
orig 1.445042906
orig 1.433590631
orig 1.426340732
orig 1.419519729
orig 1.422578648
stll 1.435229006
stll 1.436386252
stll 1.454652324
stll 1.43760086
stll 1.432428185
stll 1.434775625
stll 1.439618084
stll 1.459607035
stll 1.439808637
stll 1.442253853
-----------------------------------------------------------
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
orig 1.885272314
orig 1.894371983
orig 1.881578513
orig 2.282154784
orig 1.970788897
orig 1.88036627
orig 1.917455219
orig 1.880669436
orig 1.880472597
orig 1.929477201
stll 1.98571179
stll 1.909510103
stll 1.885918757
stll 1.886175113
stll 1.936036665
stll 1.884183483
stll 1.936353317
stll 1.886282141
stll 1.936303274
stll 1.886593089
-----------------------------------------------------------
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
orig 0.58789362
orig 0.59184246
orig 0.587967287
orig 0.588134718
orig 0.589231962
orig 0.600176239
orig 0.587345601
orig 0.589692602
orig 0.590391874
orig 0.588790516
stll 0.617989568
stll 0.599776789
stll 0.600555451
stll 0.599688356
stll 0.636933354
stll 0.917953399
stll 0.602737827
stll 0.599820535
stll 0.599344116
stll 0.601595503
-----------------------------------------------------------
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
orig 1.880699844
orig 1.885463321
orig 1.871235188
orig 1.776139242
orig 1.768804882
orig 1.813928255
orig 1.798474237
orig 1.769855196
orig 1.772887237
orig 1.774969887
stll 1.755212649
stll 1.765916881
stll 1.753125487
stll 1.793198484
stll 1.754066969
stll 1.756901637
stll 1.75644061
stll 1.791233392
stll 1.972476254
stll 1.884114605
-----------------------------------------------------------
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
orig 0.957060099
orig 0.957411888
orig 0.963470988
orig 0.958903022
orig 0.967337511
orig 0.962384705
orig 0.958645076
orig 0.95770352
orig 0.955135655
orig 0.961775851
stll 0.9429389
stll 0.943606296
stll 0.949029438
stll 0.943701328
stll 0.944859347
stll 0.942171759
stll 0.941467939
stll 0.943824571
stll 0.94144008
stll 0.947744497
-----------------------------------------------------------
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)
orig 0.360077426
orig 0.359104098
orig 0.359018956
orig 0.359092032
orig 0.359331325
orig 0.359019006
orig 0.357936676
orig 0.359091978
orig 0.358985498
orig 0.363673247
stll 0.362823285
stll 0.381718629
stll 0.363027573
stll 0.363395545
stll 0.365067534
stll 0.363031422
stll 0.363099171
stll 0.363026419
stll 0.36262485
stll 0.363246354
-----------------------------------------------------------
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)
orig 1.19546514
orig 1.183278023
orig 1.212173001
orig 1.087653349
orig 1.20140735
orig 1.183987459
orig 1.196346604
orig 1.186763176
orig 1.094528627
orig 1.189048228
stll 1.141821171
stll 1.142904285
stll 1.178747042
stll 1.181916333
stll 1.154907879
stll 1.214846227
stll 1.151054146
stll 1.185621045
stll 1.189607442
stll 1.215448142
-----------------------------------------------------------
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
orig 0.470463395
orig 0.463910925
orig 0.464827161
orig 0.463764632
orig 0.464697532
orig 0.463857276
orig 0.464311539
orig 0.477877842
orig 0.463772041
orig 0.464269611
stll 0.469503609
stll 0.469179384
stll 0.469393566
stll 0.469894459
stll 0.469383854
stll 0.468934437
stll 0.469077631
stll 0.469599363
stll 0.469048302
stll 0.470137266
-----------------------------------------------------------
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
orig 1.776248853
orig 1.734098752
orig 1.726329029
orig 1.717729015
orig 1.723574111
orig 1.858471666
orig 1.738485008
orig 1.71906145
orig 1.717009932
orig 1.739294577
stll 1.723627502
stll 1.727801841
stll 1.732547779
stll 1.721272043
stll 1.720609006
stll 1.719929987
stll 1.724219175
stll 1.892292358
stll 1.879054572
stll 1.765989043
-----------------------------------------------------------
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
orig 1.326750513
orig 1.281467312
orig 1.341676341
orig 1.154036421
orig 1.088513305
orig 1.362177061
orig 1.237257317
orig 1.186542107
orig 1.202354104
orig 1.087300805
stll 1.089515037
stll 1.096151008
stll 1.095826107
stll 1.09110839
stll 1.08988974
stll 1.086924157
stll 1.08689725
stll 1.087652692
stll 1.086958201
stll 1.086968367
-----------------------------------------------------------
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
orig 1.406125838
orig 1.420390519
orig 1.410263949
orig 1.456576401
orig 1.453218966
orig 1.412157335
orig 1.420401316
orig 1.406924099
orig 1.411840276
orig 1.408635788
stll 1.413086011
stll 1.410921039
stll 1.515902883
stll 1.42461814
stll 1.49368099
stll 1.593859797
stll 1.731580157
stll 1.536495996
stll 1.59667807
stll 1.40971823
-----------------------------------------------------------
vm1_block
def m
yield
end
i = 0
while i<30_000_000 # while loop 1
i += 1
m{
}
end
orig 2.004619915
orig 1.984161039
orig 2.000238866
orig 1.994394683
orig 1.986587118
orig 2.027757692
orig 2.048867635
orig 1.981987365
orig 1.986718518
orig 2.049096827
stll 1.985284802
stll 2.076749991
stll 1.987910221
stll 1.994191389
stll 1.988661818
stll 1.986830653
stll 2.16810906
stll 1.990068097
stll 2.424476009
stll 2.438980967
-----------------------------------------------------------
vm1_const
Const = 1
i = 0
while i<30_000_000 # while loop 1
i += 1
j = Const
k = Const
end
orig 0.724011415
orig 0.751993343
orig 0.828428348
orig 0.724765577
orig 0.723729441
orig 0.876904781
orig 0.762510992
orig 0.727887555
orig 0.724300319
orig 0.723454546
stll 0.720973701
stll 0.721035578
stll 0.721423021
stll 0.721296312
stll 0.721248332
stll 0.724508718
stll 0.720067769
stll 0.721091193
stll 0.720684421
stll 0.720590542
-----------------------------------------------------------
vm1_ensure
i = 0
while i<30_000_000 # benchmark loop 1
i += 1
begin
begin
ensure
end
ensure
end
end
orig 0.510265405
orig 0.511039576
orig 0.510855647
orig 0.510571646
orig 0.510487244
orig 0.510646966
orig 0.510903815
orig 0.511170774
orig 0.510245093
orig 0.510242364
stll 0.513740223
stll 0.513880149
stll 0.513927762
stll 0.513652705
stll 0.513784976
stll 0.513959367
stll 0.513939594
stll 0.513989961
stll 0.513810522
stll 0.513645247
-----------------------------------------------------------
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
orig 4.352794815
orig 4.427100234
orig 4.357426692
orig 4.242957955
orig 5.749445486
orig 4.861683109
orig 4.611913164
orig 4.248991524
orig 4.310098038
orig 4.331423845
stll 4.40533171
stll 4.385436746
stll 4.539163247
stll 4.451554309
stll 5.371444941
stll 5.058826984
stll 4.394677752
stll 4.399262148
stll 4.622233003
stll 4.341218332
-----------------------------------------------------------
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
orig 9.299003918
orig 9.607103822
orig 9.52348325
orig 9.351952746
orig 9.166694274
orig 9.154672515
orig 9.241831242
orig 9.222188708
orig 9.097087049
orig 9.083368277
stll 8.979892772
stll 8.948615418
stll 8.94358949
stll 8.977953226
stll 8.930222551
stll 8.966036805
stll 9.165879242
stll 9.162806971
stll 8.928880773
stll 8.908029302
-----------------------------------------------------------
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
orig 10.979590732
orig 11.069026647
orig 10.989757024
orig 10.980927352
orig 10.92604894
orig 11.045978772
orig 11.032459172
orig 10.968647442
orig 11.022738346
orig 11.050070382
stll 11.108989548
stll 10.895239351
stll 10.893372779
stll 11.098307264
stll 11.264270621
stll 10.939747221
stll 10.948628476
stll 10.922754727
stll 10.989071546
stll 10.884562285
-----------------------------------------------------------
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
orig 9.85388492
orig 9.862436618
orig 9.853143666
orig 9.876420308
orig 9.895540064
orig 9.900466407
orig 9.851785308
orig 9.893819847
orig 9.875527071
orig 9.904952073
stll 9.738025396
stll 9.719086171
stll 10.183026952
stll 9.74686711
stll 9.719312983
stll 9.702301885
stll 9.735284114
stll 9.763578466
stll 9.721462461
stll 9.747227936
-----------------------------------------------------------
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
orig 9.50395045
orig 9.584649781
orig 9.719530802
orig 9.594610927
orig 9.338013872
orig 9.403705508
orig 10.788435743
orig 9.423518406
orig 10.013764648
orig 9.570680255
stll 9.208967684
stll 9.382788648
stll 9.32592605
stll 9.214151825
stll 9.212628448
stll 9.275158815
stll 9.382481485
stll 9.387072921
stll 9.167268354
stll 9.494654659
-----------------------------------------------------------
vm1_gc_wb_ary
long_lived = []
GC.start
GC.start
i = 0
short_lived = ''
while i<30_000_000 # while loop 1
long_lived[0] = short_lived # write barrier
i+=1
end
orig 1.147797702
orig 1.07551601
orig 1.083096096
orig 1.074741102
orig 1.075512916
orig 1.087115413
orig 1.075316172
orig 1.077487324
orig 1.075465058
orig 1.075222562
stll 1.064514195
stll 1.065066605
stll 1.067178167
stll 1.06696848
stll 1.104947844
stll 1.0698162
stll 1.067390951
stll 1.065605883
stll 1.14866906
stll 1.085749239
-----------------------------------------------------------
vm1_gc_wb_obj
class C
attr_accessor :foo
end
long_lived = C.new
GC.start
GC.start
i = 0
short_lived = ''
while i<30_000_000 # while loop 1
long_lived.foo = short_lived # write barrier
i+=1
end
orig 1.065491155
orig 1.339934267
orig 1.126352377
orig 1.118274006
orig 1.121598522
orig 1.0945944
orig 1.299849679
orig 1.126306965
orig 1.051445321
orig 1.359615822
stll 1.529405906
stll 1.061978983
stll 1.059987439
stll 1.056625144
stll 1.061240029
stll 1.058547356
stll 1.064332586
stll 1.06430658
stll 1.284736673
stll 1.081213917
-----------------------------------------------------------
vm1_ivar
@a = 1
i = 0
while i<30_000_000 # while loop 1
i += 1
j = @a
k = @a
end
orig 0.732845415
orig 0.736293149
orig 0.771818895
orig 0.840215944
orig 0.756953726
orig 0.73349172
orig 0.732729929
orig 0.732720846
orig 0.732638614
orig 0.733124223
stll 0.733305094
stll 0.73316103
stll 0.733085095
stll 0.73311374
stll 0.733009473
stll 0.740021408
stll 0.733247148
stll 0.733161471
stll 0.733154861
stll 0.733016812
-----------------------------------------------------------
vm1_ivar_set
i = 0
while i<30_000_000 # while loop 1
i += 1
@a = 1
@b = 2
end
orig 0.906701623
orig 0.90271781
orig 0.891999967
orig 0.890021645
orig 0.897370889
orig 0.888535227
orig 0.956963337
orig 0.912073158
orig 1.346196183
orig 0.966576753
stll 1.12214036
stll 0.964292539
stll 1.021842033
stll 1.282939856
stll 1.159691711
stll 1.361047186
stll 0.922545639
stll 1.003385877
stll 1.263600194
stll 0.93657982
-----------------------------------------------------------
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
orig 0.919564573
orig 0.923974728
orig 0.920407549
orig 0.920451743
orig 0.920319989
orig 0.920456607
orig 0.920767013
orig 0.920226718
orig 0.920368093
orig 0.920341266
stll 0.92076659
stll 0.920485496
stll 0.920565386
stll 1.26941394
stll 0.920474983
stll 0.92038875
stll 0.920444582
stll 0.9203879
stll 0.923340819
stll 0.921364909
-----------------------------------------------------------
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
orig 1.71203098
orig 1.708061695
orig 1.933030959
orig 1.814921006
orig 2.065309732
orig 1.733509022
orig 1.780352332
orig 2.16590027
orig 1.783162329
orig 2.626269635
stll 2.558632335
stll 1.861565075
stll 2.577726662
stll 2.631456942
stll 1.827923592
stll 1.702482632
stll 1.71663206
stll 1.754538343
stll 1.696627162
stll 1.691055796
-----------------------------------------------------------
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
orig 2.475366347
orig 2.473178776
orig 2.476519503
orig 2.476033007
orig 2.475486809
orig 2.473323796
orig 2.517870031
orig 2.625114464
orig 2.484786033
orig 2.596214747
stll 2.526130626
stll 2.610164374
stll 2.88131717
stll 2.851746956
stll 2.762483063
stll 2.472280032
stll 2.472686528
stll 2.472592859
stll 2.47240747
stll 2.473508289
-----------------------------------------------------------
vm1_neq
i = 0
obj1 = Object.new
obj2 = Object.new
while i<30_000_000 # while loop 1
i += 1
obj1 != obj2
end
orig 0.968142968
orig 0.954512479
orig 0.955811063
orig 0.954303277
orig 1.058883621
orig 1.009745469
orig 0.990800628
orig 1.049664067
orig 1.161817696
orig 1.632842791
stll 1.121360525
stll 0.95798036
stll 0.9535098
stll 1.343705833
stll 0.975003782
stll 0.959950174
stll 1.339184229
stll 1.218822788
stll 0.959301719
stll 0.988312683
-----------------------------------------------------------
vm1_not
i = 0
obj = Object.new
while i<30_000_000 # while loop 1
i += 1
!obj
end
orig 1.058006785
orig 0.894977125
orig 0.74971253
orig 0.999090716
orig 1.080774049
orig 0.980370634
orig 0.779352881
orig 0.748725214
orig 0.7492704
orig 0.791591259
stll 0.760867522
stll 0.817209155
stll 0.765411921
stll 0.750915306
stll 1.016355917
stll 0.803063321
stll 0.781027784
stll 0.898436709
stll 0.793891822
stll 0.785001297
-----------------------------------------------------------
vm1_rescue
i = 0
while i<30_000_000 # while loop 1
i += 1
begin
rescue
end
end
orig 0.614962557
orig 0.618616117
orig 0.627111337
orig 0.62586782
orig 0.754401771
orig 0.854392256
orig 0.686720247
orig 0.613991738
orig 0.613965382
orig 0.615000411
stll 0.616104035
stll 0.633980773
stll 0.625831908
stll 0.634039862
stll 0.614295319
stll 0.614046736
stll 0.613890434
stll 0.613880872
stll 0.613995646
stll 0.613880132
-----------------------------------------------------------
vm1_simplereturn
def m
return 1
end
i = 0
while i<30_000_000 # while loop 1
i += 1
m
end
orig 1.226309989
orig 1.387738832
orig 1.256992291
orig 1.24285113
orig 1.225559321
orig 1.223404655
orig 1.224599234
orig 1.226168386
orig 1.226112643
orig 1.225337169
stll 1.248849294
stll 1.225427281
stll 1.222688858
stll 1.222109651
stll 1.222273327
stll 1.221765554
stll 1.222243693
stll 1.370048617
stll 1.344156583
stll 1.226515337
-----------------------------------------------------------
vm1_swap
a = 1
b = 2
i = 0
while i<30_000_000 # while loop 1
i += 1
a, b = b, a
end
orig 0.730301752
orig 0.731396407
orig 0.83343086
orig 0.728030834
orig 0.89796579
orig 1.000808575
orig 0.999893291
orig 0.896495108
orig 0.730830802
orig 0.727731168
stll 0.727961825
stll 0.773433632
stll 0.743611846
stll 0.945669505
stll 0.944430407
stll 0.942770799
stll 0.943226399
stll 0.783553899
stll 0.726884758
stll 0.726973646
-----------------------------------------------------------
vm1_yield
def m
i = 0
while i<30_000_000 # while loop 1
i += 1
yield
end
end
m{}
orig 1.17570019
orig 1.229845265
orig 1.400185349
orig 1.321732851
orig 1.258243122
orig 2.123445381
orig 1.724213478
orig 1.478238257
orig 1.205834779
orig 1.176394306
stll 1.228914764
stll 1.188647615
stll 1.19757616
stll 1.360537121
stll 1.180653906
stll 1.24975019
stll 1.3785968
stll 1.231586966
stll 1.234262815
stll 1.247705207
-----------------------------------------------------------
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
orig 0.73824619
orig 0.737371085
orig 0.807479761
orig 0.744885591
orig 0.747952004
orig 0.743777795
orig 0.736196617
orig 0.738309815
orig 0.737062439
orig 0.750747667
stll 0.771446239
stll 0.757887449
stll 0.738576221
stll 0.809367362
stll 0.755662815
stll 0.740865405
stll 0.745320753
stll 0.772665581
stll 0.7367682
stll 0.771393985
-----------------------------------------------------------
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
orig 6.686484237
orig 6.708665217
orig 6.715444231
orig 6.728438973
orig 6.699407643
orig 6.773321832
orig 6.731451273
orig 6.768405943
orig 6.957647974
orig 6.8823709
stll 6.990485803
stll 6.85722822
stll 7.04176214
stll 7.059733317
stll 7.042386024
stll 6.891391669
stll 6.73829468
stll 7.213554228
stll 6.951761117
stll 6.957400362
-----------------------------------------------------------
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
orig 4.20879843
orig 3.910994204
orig 3.840111163
orig 3.840781478
orig 3.850745917
orig 3.878929864
orig 3.888859114
orig 3.832355612
orig 3.851203777
orig 3.805135264
stll 3.321646569
stll 3.357736691
stll 3.289268425
stll 3.348414717
stll 3.475979835
stll 3.494052154
stll 3.397488885
stll 3.36792594
stll 3.363455023
stll 3.312310045
-----------------------------------------------------------
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
orig 0.196835984
orig 0.195341766
orig 0.195162702
orig 0.194332785
orig 0.195400058
orig 0.198119613
orig 0.197866245
orig 0.198764721
orig 0.19691054
orig 0.194426193
stll 0.201035104
stll 0.195909645
stll 0.196587409
stll 0.197526548
stll 0.197254119
stll 0.197333349
stll 0.199120289
stll 0.207097861
stll 0.203300542
stll 0.197628782
-----------------------------------------------------------
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
orig 2.740640336
orig 2.716431221
orig 2.724859599
orig 2.933273936
orig 2.744307799
orig 2.961672792
orig 2.737026437
orig 2.728455237
orig 2.869693445
orig 2.996770567
stll 2.768419434
stll 3.020252934
stll 2.97175786
stll 3.021297248
stll 2.931910307
stll 3.07090447
stll 3.115585193
stll 3.166649582
stll 2.782318973
stll 3.001319958
-----------------------------------------------------------
vm2_dstr
i = 0
x = y = 'z'
while i<6_000_000 # benchmark loop 2
i += 1
str = "foo#{x}bar#{y}baz"
end
orig 1.273185868
orig 1.267542551
orig 1.256862391
orig 1.256289059
orig 1.253628018
orig 1.255953478
orig 1.256287732
orig 1.275573216
orig 1.253663501
orig 1.253545566
stll 1.258879865
stll 1.259996063
stll 1.317688224
stll 1.314313777
stll 1.376796101
stll 1.261548187
stll 1.277180761
stll 1.382023106
stll 1.256838963
stll 1.259226783
-----------------------------------------------------------
vm2_eval
i = 0
while i<6_000_000 # benchmark loop 2
i += 1
eval("1")
end
orig 13.490363308
orig 13.391284216
orig 13.319809015
orig 13.563180888
orig 13.459640705
orig 13.703297321
orig 13.490092353
orig 13.647006588
orig 13.314201223
orig 13.335290271
stll 13.489244819
stll 13.464344185
stll 13.386064361
stll 13.800102224
stll 13.449417796
stll 13.529014087
stll 13.403679597
stll 13.395622618
stll 13.531325513
stll 13.378471666
-----------------------------------------------------------
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
orig 1.497883019
orig 1.349596421
orig 1.383327376
orig 1.394124626
orig 1.359510367
orig 1.414043155
orig 1.36793866
orig 1.37444144
orig 1.372978551
orig 1.394028008
stll 1.391830038
stll 1.393725073
stll 1.363125867
stll 1.34614657
stll 1.38511985
stll 1.367251947
stll 1.351907635
stll 1.346439619
stll 1.371228239
stll 1.345467984
-----------------------------------------------------------
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
orig 1.932546917
orig 1.934455679
orig 1.93854172
orig 1.950912021
orig 1.976581969
orig 1.942608988
orig 1.945635695
orig 1.949595676
orig 1.937782962
orig 1.940176255
stll 1.922861442
stll 1.979757776
stll 2.009199031
stll 2.084504719
stll 2.006731683
stll 2.170731467
stll 1.925568209
stll 1.933497754
stll 1.958627951
stll 2.023735618
-----------------------------------------------------------
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
orig 1.535500009
orig 1.534057029
orig 1.529463316
orig 1.532181882
orig 1.526631008
orig 1.526960027
orig 1.537940015
orig 1.550714434
orig 1.532147733
orig 1.525579625
stll 1.538325067
stll 1.521428564
stll 1.520290731
stll 1.539246577
stll 1.521422425
stll 1.528081874
stll 1.52097376
stll 1.518730775
stll 1.536835565
stll 1.572949428
-----------------------------------------------------------
vm2_mutex
require 'thread'
m = Mutex.new
i = 0
while i<6_000_000 # benchmark loop 2
i += 1
m.synchronize{}
end
orig 0.739153718
orig 0.758694072
orig 0.72497689
orig 0.722191234
orig 0.773226641
orig 0.720953542
orig 0.7228843
orig 0.729210501
orig 0.767927142
orig 0.725675294
stll 0.727837451
stll 0.731015119
stll 0.725992194
stll 0.722904121
stll 0.723316265
stll 0.730713471
stll 0.727438374
stll 0.725525296
stll 0.724396052
stll 0.768241676
-----------------------------------------------------------
vm2_newlambda
i = 0
while i<6_000_000 # benchmark loop 2
i += 1
lambda {}
end
orig 0.822555793
orig 0.832994932
orig 0.882269455
orig 0.820697696
orig 0.822728876
orig 0.821214081
orig 0.868972823
orig 0.870471792
orig 0.821473512
orig 0.821745978
stll 0.829513172
stll 0.873588178
stll 0.828993038
stll 0.824177145
stll 0.828011442
stll 0.824918656
stll 0.84767392
stll 0.826742896
stll 0.839770483
stll 0.843395494
-----------------------------------------------------------
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
orig 2.326237859
orig 2.266256095
orig 2.235942037
orig 2.288210056
orig 2.274665021
orig 2.248117362
orig 2.258712091
orig 2.221985868
orig 2.23021852
orig 2.311983839
stll 2.223783136
stll 2.258611694
stll 2.257393307
stll 2.334440796
stll 2.557367006
stll 2.23185053
stll 2.237156024
stll 2.232835424
stll 2.239021717
stll 2.726531501
-----------------------------------------------------------
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
orig 0.275886321
orig 0.305978652
orig 0.275437115
orig 0.275531912
orig 0.350827979
orig 0.293155119
orig 0.319846569
orig 0.302610138
orig 0.296192913
orig 0.301054013
stll 0.289516981
stll 0.274331768
stll 0.274466841
stll 0.273935342
stll 0.273578254
stll 0.2764675
stll 0.276368437
stll 0.2862352
stll 0.282155416
stll 0.286209383
-----------------------------------------------------------
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
orig 0.487605351
orig 0.492358452
orig 0.490108473
orig 0.496589868
orig 0.494560116
orig 0.532761958
orig 0.609371968
orig 0.498319369
orig 0.490103889
orig 0.735836153
stll 0.507268309
stll 0.493875729
stll 0.50110458
stll 0.525028376
stll 0.501418531
stll 0.498359718
stll 0.688990206
stll 0.505072285
stll 0.497818643
stll 0.54148073
-----------------------------------------------------------
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
orig 5.311127359
orig 5.390314221
orig 5.328343583
orig 5.562379409
orig 6.844047389
orig 5.57739729
orig 5.384502289
orig 5.73890192
orig 5.237066776
orig 5.615761964
stll 5.503445093
stll 5.225865177
stll 5.438818665
stll 5.64426263
stll 5.324782953
stll 5.381946793
stll 5.678803147
stll 5.310660225
stll 5.642545241
stll 5.345868388
-----------------------------------------------------------
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
orig 7.692413838
orig 7.696555486
orig 7.992847615
orig 7.810899032
orig 7.788691128
orig 8.124372478
orig 7.926554513
orig 7.738638769
orig 7.727894361
orig 7.775751114
stll 7.88410877
stll 7.776840742
stll 7.842858133
stll 7.724970863
stll 8.025117301
stll 7.785907733
stll 7.732682048
stll 7.812724216
stll 10.516519054
stll 8.221834305
-----------------------------------------------------------
vm2_regexp
i = 0
str = 'xxxhogexxx'
while i<6_000_000 # benchmark loop 2
/hoge/ =~ str
i += 1
end
orig 1.268980275
orig 1.201561586
orig 1.28761712
orig 1.174532139
orig 1.176820961
orig 1.177446994
orig 1.191394707
orig 1.213051569
orig 1.229802049
orig 1.199717933
stll 1.406724093
stll 1.873657512
stll 1.235636588
stll 1.180592023
stll 1.180405011
stll 1.179492048
stll 1.179240929
stll 1.178992879
stll 1.179920336
stll 1.178143189
-----------------------------------------------------------
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
orig 0.375499778
orig 0.375399703
orig 0.375428611
orig 0.375318016
orig 0.391465056
orig 0.375391269
orig 0.379284615
orig 0.375393927
orig 0.375227137
orig 0.375061281
stll 0.38743732
stll 0.37392435
stll 0.384839361
stll 0.374891749
stll 0.381980701
stll 0.399061969
stll 0.375260479
stll 0.424430882
stll 0.649389972
stll 0.658862578
-----------------------------------------------------------
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
orig 0.958544917
orig 0.95822058
orig 0.819465865
orig 0.499026628
orig 0.499177863
orig 0.499600332
orig 0.500004225
orig 0.501529214
orig 0.500463355
orig 0.499805492
stll 0.507933667
stll 0.496059393
stll 0.516503062
stll 0.499936802
stll 0.504115618
stll 0.497044931
stll 0.525926702
stll 0.520227426
stll 0.497140025
stll 0.496479982
-----------------------------------------------------------
vm2_unif1
i = 0
def m a, b
end
while i<6_000_000 # benchmark loop 2
i += 1
m 100, 200
end
orig 0.276554421
orig 0.272975708
orig 0.272853563
orig 0.281795113
orig 0.27296358
orig 0.272952064
orig 0.275852591
orig 0.272725647
orig 0.272893154
orig 0.272895589
stll 0.27322529
stll 0.273127852
stll 0.273053935
stll 0.272907013
stll 0.273236757
stll 0.28468084
stll 0.315127313
stll 0.291731107
stll 0.286106583
stll 0.273239757
-----------------------------------------------------------
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
orig 0.514349501
orig 0.519724578
orig 0.516974954
orig 0.514313814
orig 0.515758378
orig 0.514475406
orig 0.827379433
orig 0.514494908
orig 0.526002028
orig 0.853725532
stll 0.51739732
stll 0.51495405
stll 0.546691061
stll 0.54049117
stll 0.644810826
stll 0.751828834
stll 0.588514948
stll 0.518992833
stll 0.512499102
stll 0.559811508
-----------------------------------------------------------
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
orig 0.144840928
orig 0.142657391
orig 0.142533026
orig 0.145085188
orig 0.142756092
orig 0.144094462
orig 0.146588816
orig 0.148375788
orig 0.140469535
orig 0.141194009
stll 0.141713494
stll 0.143726215
stll 0.141439089
stll 0.14475942
stll 0.144933465
stll 0.144800219
stll 0.143130206
stll 0.141121701
stll 0.141097222
stll 0.143603039
-----------------------------------------------------------
vm3_clearmethodcache
i = 0
while i<200_000
i += 1
Class.new{
def m; end
}
end
orig 0.404271737
orig 0.39266564
orig 0.391837834
orig 0.391336176
orig 0.393378964
orig 0.395533111
orig 0.392877222
orig 0.400904708
orig 0.392621967
orig 0.390293488
stll 0.395890107
stll 0.413310319
stll 0.419650327
stll 0.399710606
stll 0.392865163
stll 0.39254773
stll 0.398473421
stll 0.39348053
stll 0.395670151
stll 0.392723628
-----------------------------------------------------------
vm3_gc
#! /usr/bin/ruby
5000.times do
100.times do
{"xxxx"=>"yyyy"}
end
GC.start
end
orig 2.115529024
orig 2.116169962
orig 2.140990368
orig 2.117888375
orig 2.107327782
orig 2.117847576
orig 2.107726879
orig 2.113756236
orig 2.098598614
orig 2.108233376
stll 2.236541119
stll 2.141630102
stll 2.106511716
stll 2.124389434
stll 2.112392234
stll 2.163199193
stll 2.186435535
stll 2.116584433
stll 2.112300412
stll 2.108126997
-----------------------------------------------------------
vm_thread_alive_check1
5_000.times{
t = Thread.new{}
while t.alive?
Thread.pass
end
}
orig 40.654424318
orig 40.591822222
orig 40.703927842
orig 40.672611947
orig 40.630475949
orig 40.623682078
orig 40.581170949
orig 40.58866893
orig 40.600151628
orig 40.600728054
stll 40.587726318
stll 40.626521683
stll 40.671568378
stll 40.649703953
stll 40.666439782
stll 40.538390481
stll 40.662454896
stll 40.54273179
stll 40.494787422
stll 40.664949354
-----------------------------------------------------------
vm_thread_close
1000.times { Thread.new { sleep } }
i = 0
while i<100_000 # benchmark loop 3
i += 1
IO.pipe.each(&:close)
end
orig 3.450554812
orig 3.287614932
orig 3.252715753
orig 3.3008256
orig 3.381139325
orig 3.333134435
orig 3.250352337
orig 3.267024248
orig 3.238626588
orig 3.289960887
stll 3.266113851
stll 3.280930809
stll 3.366264585
stll 3.271376227
stll 3.264973628
stll 3.304123725
stll 3.173035934
stll 3.208949451
stll 3.326825231
stll 3.395628869
-----------------------------------------------------------
vm_thread_create_join
i = 0
while i<100_000 # benchmark loop 3
i += 1
Thread.new{
}.join
end
orig 2.372775092
orig 2.352637844
orig 2.262079765
orig 2.210738934
orig 2.205987859
orig 2.407110532
orig 2.173356132
orig 2.299178228
orig 2.229149612
orig 2.259245285
stll 2.224398723
stll 2.226041684
stll 2.300789101
stll 2.338296881
stll 2.296278624
stll 2.266404719
stll 2.452862553
stll 2.351395609
stll 2.283968555
stll 2.206752758
-----------------------------------------------------------
vm_thread_mutex1
# one thread, one mutex (no contention)
require 'thread'
m = 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
orig 0.635522283
orig 0.554123253
orig 0.549552467
orig 0.549268984
orig 0.553543827
orig 0.622636518
orig 0.806108278
orig 0.548406001
orig 0.888223943
orig 0.691999112
stll 0.544612135
stll 0.545474615
stll 0.546425162
stll 0.545381385
stll 0.554829948
stll 0.544843098
stll 0.54496311
stll 0.544434742
stll 0.544592759
stll 0.545839255
-----------------------------------------------------------
vm_thread_mutex2
# two threads, one mutex
require 'thread'
m = 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
orig 0.572128297
orig 0.576332316
orig 0.566920123
orig 0.569185976
orig 0.573532211
orig 0.56833157
orig 0.573200064
orig 0.572925775
orig 0.567218244
orig 0.581709838
stll 0.563911666
stll 0.563880294
stll 0.566890233
stll 0.570359346
stll 0.578911669
stll 0.563852429
stll 0.565207214
stll 0.567358572
stll 0.562909605
stll 0.569521178
-----------------------------------------------------------
vm_thread_mutex3
# 1000 threads, one mutex
require 'thread'
m = 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
orig 0.663592438
orig 0.666536385
orig 0.659510603
orig 0.661673613
orig 0.66269806
orig 0.658988787
orig 0.66322222
orig 0.661411552
orig 0.663641136
orig 0.661921818
stll 0.660929972
stll 0.661353911
stll 0.657409355
stll 0.659650624
stll 0.66193297
stll 0.655136509
stll 0.667381205
stll 0.658995725
stll 0.66134587
stll 0.660455218
-----------------------------------------------------------
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}
orig 0.161549537
orig 0.159608209
orig 0.161272874
orig 0.161757052
orig 0.161021168
orig 0.160855899
orig 0.15835622
orig 0.161532774
orig 0.160570638
orig 0.158302028
stll 0.161657228
stll 0.162963641
stll 0.159081461
stll 0.159694397
stll 0.160830294
stll 0.161074473
stll 0.158827159
stll 0.158503613
stll 0.158143838
stll 0.159628808
-----------------------------------------------------------
vm_thread_pass_flood
1000.times{
Thread.new{loop{Thread.pass}}
}
i = 0
while i<10000
i += 1
end
orig 0.070448288
orig 0.070411529
orig 0.068074827
orig 0.067710877
orig 0.068247412
orig 0.071154337
orig 0.067616512
orig 0.067798783
orig 0.06819606
orig 0.068222427
stll 0.068969975
stll 0.06837987
stll 0.069892416
stll 0.06827312
stll 0.067956212
stll 0.070335651
stll 0.068206125
stll 0.068747337
stll 0.068304718
stll 0.06845048
-----------------------------------------------------------
vm_thread_pipe
# Mesure 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}
orig 0.196192101
orig 0.227110165
orig 0.226758843
orig 0.220738313
orig 0.222194424
orig 0.221554786
orig 0.234592994
orig 0.224196739
orig 0.223174755
orig 0.227651556
stll 0.221975245
stll 0.22863621
stll 0.217473043
stll 0.194895273
stll 0.218700974
stll 0.21848605
stll 0.223427233
stll 0.220396526
stll 0.218585784
stll 0.222415907
-----------------------------------------------------------
vm_thread_queue
require 'thread'
n = 1_000_000
q = Queue.new
consumer = Thread.new{
while q.pop
# consuming
end
}
producer = Thread.new{
n.times{
q.push true
}
q.push nil
}
consumer.join
orig 0.113205297
orig 0.113119815
orig 0.114581367
orig 0.11611283
orig 0.112890154
orig 0.112730259
orig 0.114046619
orig 0.112805781
orig 0.113794639
orig 0.113357915
stll 0.111633923
stll 0.11191329
stll 0.112479745
stll 0.112423343
stll 0.11282222
stll 0.111614273
stll 0.11187231
stll 0.112063403
stll 0.112616271
stll 0.112089954
-----------------------------------------------------------
raw data:
[["app_answer",
[[0.053822168,
0.054029033,
0.05420699,
0.05374481,
0.054266707,
0.053863589,
0.057185724,
0.05387,
0.053834501,
0.05408797],
[0.054842263,
0.05406647,
0.054126083,
0.054508985,
0.055946202,
0.053851443,
0.054151559,
0.054021872,
0.054684883,
0.053992802]]],
["app_aobench",
[[43.076738901,
43.028016045,
43.197667739,
44.312146415,
42.993375293,
43.096511663,
43.111997889,
43.14533459,
42.96419694,
43.581617607],
[42.731068343,
42.91853553,
43.539508991,
46.036135327,
44.702937628,
43.279324603,
43.322062172,
46.042519525,
43.711278628,
44.468188102]]],
["app_erb",
[[0.877973788,
0.873433795,
0.937733265,
0.884718992,
0.87286147,
0.890507022,
0.873429153,
0.870941343,
0.874882247,
0.87176688],
[0.872209629,
0.868533232,
0.872928831,
0.873147049,
0.867231466,
0.872875146,
0.874811633,
0.882248124,
0.873005187,
0.891447572]]],
["app_factorial",
[[0.805401632,
0.806380912,
0.805792719,
0.806436317,
0.808000536,
0.804695953,
0.804775601,
0.808004935,
0.808079104,
0.806497236],
[0.752931959,
0.75402637,
0.752723328,
0.75777318,
0.752127311,
0.752263454,
0.755094515,
0.754753176,
0.753876487,
0.757509723]]],
["app_fib",
[[0.477865003,
0.499373551,
0.479733716,
0.480720254,
0.4740355,
0.480593195,
0.475646497,
0.481992312,
0.475438603,
0.591133305],
[0.476690551,
0.479981071,
0.488814861,
0.506066234,
0.476148832,
0.477693471,
0.480147474,
0.475824736,
0.623956849,
0.502471049]]],
["app_lc_fizzbuzz",
[[68.4564067,
69.127990261,
70.253889911,
67.784253118,
67.891071347,
66.856999744,
68.239627371,
68.355507495,
65.787745599,
66.527444796],
[69.579906637,
67.215046349,
66.969033824,
65.271179722,
65.783239733,
69.280211269,
66.660859374,
66.130403877,
64.967371958,
63.875867786]]],
["app_mandelbrot",
[[1.459894239,
1.489491642,
0.902506879,
0.903327177,
0.898419648,
0.899715521,
0.898631131,
0.900987302,
0.901816105,
0.907537929],
[0.89145598,
0.890685262,
0.906450235,
0.896532126,
0.892681072,
0.890940665,
0.899069383,
1.08214218,
0.910197243,
0.89143809]]],
["app_pentomino",
[[13.538910944,
13.649177685,
13.449619533,
13.874335848,
13.704765446,
13.940837522,
14.643880507,
13.702187804,
13.56631364,
13.460903579],
[13.960857016,
14.283383114,
13.892281614,
13.792446335,
13.585338039,
14.079598714,
13.541945066,
13.555718528,
13.688990303,
13.653538944]]],
["app_raise",
[[0.256718303,
0.256379292,
0.260501366,
0.256184826,
0.256770062,
0.259899614,
0.25704115,
0.255111165,
0.263036359,
0.254985853],
[0.255509678,
0.256840589,
0.261421628,
0.258192571,
0.25849846,
0.258302149,
0.255546399,
0.261529648,
0.259741815,
0.255793305]]],
["app_strconcat",
[[0.960328798,
0.977739962,
0.968757826,
0.966953146,
0.955175821,
0.968254937,
0.966052117,
0.957227335,
0.968715024,
0.955896901],
[0.936486221,
0.932618274,
0.93241836,
0.958049731,
0.930236464,
0.93580221,
0.927296582,
0.930261898,
0.949535208,
0.997820343]]],
["app_tak",
[[0.751258597,
0.673566743,
0.673689533,
0.715104175,
0.66300676,
0.669495475,
0.805775253,
0.70083882,
0.705970981,
0.818605321],
[0.663240028,
0.697075786,
0.699114141,
0.662322789,
0.662610921,
0.665765452,
0.67200912,
0.662522779,
0.683096156,
0.662753224]]],
["app_tarai",
[[0.556255576,
0.553993818,
0.5601169,
0.558580523,
0.550725365,
0.568340898,
0.549644452,
0.567195744,
0.553216743,
0.55903324],
[0.54721175,
0.546947964,
0.553037629,
0.547740836,
0.551975179,
0.555337569,
0.549248576,
0.553858963,
0.550279761,
0.553504042]]],
["app_uri",
[[0.678858713,
0.679524437,
0.70871908,
0.689013331,
0.683252542,
0.681265405,
0.687151738,
0.679977733,
0.679899615,
0.685387708],
[0.663888328,
0.668038202,
0.674654907,
0.662838139,
0.670028513,
0.659243954,
0.667394447,
0.665213561,
0.669254498,
0.679531385]]],
["hash_aref_miss",
[[0.446768558,
0.441774664,
0.440020956,
0.419697422,
0.42437844,
0.435643711,
0.437852003,
0.436893765,
0.422652494,
0.418014289],
[0.445995292,
0.449304373,
0.433700582,
0.474588809,
0.49473485,
0.46307417,
0.443920226,
0.45626427,
0.436658571,
0.450609853]]],
["hash_aref_str",
[[0.429413779,
0.406133564,
0.413652752,
0.407510655,
0.432466956,
0.406426398,
0.65012434,
0.613034347,
0.404176082,
0.538524857],
[0.405808621,
0.413312202,
0.401850785,
0.397737761,
0.396488459,
0.415100215,
0.408193783,
0.407542879,
0.406234235,
0.406430393]]],
["hash_aref_sym",
[[0.615211082,
0.782243067,
0.781443557,
0.64885976,
0.715190894,
0.615359601,
0.607669017,
0.610745167,
0.616113301,
0.619308977],
[0.619563668,
0.612723157,
0.611511672,
0.652681754,
0.698859367,
0.616637831,
0.618543489,
0.628100083,
0.634441625,
0.614356095]]],
["hash_aref_sym_long",
[[1.374003318,
1.383922357,
1.369967781,
1.372910504,
1.375160122,
1.375002345,
1.378900439,
1.390391656,
1.381341628,
1.376968608],
[1.397013071,
1.390732093,
1.650411114,
1.397701355,
1.450352241,
1.492276221,
1.398620443,
1.440458357,
1.412398528,
1.468146035]]],
["hash_flatten",
[[0.412321897,
0.40762904,
0.410505076,
0.411412774,
0.412726052,
0.409271151,
0.408371527,
0.411232503,
0.412040655,
0.417467342],
[0.425944272,
0.419393809,
0.419178041,
0.422701223,
0.42640161,
0.431700433,
0.425823307,
0.428960291,
0.427122089,
0.421448606]]],
["hash_ident_num",
[[0.295713337,
0.283685437,
0.284802222,
0.287065827,
0.285974218,
0.29045913,
0.287852136,
0.281939658,
0.302169303,
0.285425191],
[0.283365793,
0.283044646,
0.283608866,
0.2947435,
0.282815534,
0.286135003,
0.284034278,
0.284348426,
0.282969689,
0.29209817]]],
["hash_ident_obj",
[[0.299977594,
0.28323321,
0.279770218,
0.288053726,
0.27808,
0.302275651,
0.282260369,
0.289452943,
0.290050327,
0.286439327],
[0.281474478,
0.45254817,
0.284468923,
0.291538696,
0.307934031,
0.27969676,
0.282224447,
0.299456978,
0.288548865,
0.295508415]]],
["hash_ident_str",
[[0.281492569,
0.279452627,
0.306886348,
0.293875706,
0.27767955,
0.282340644,
0.282513711,
0.277737484,
0.27840241,
0.306377801],
[0.285180983,
0.286158359,
0.28488322,
0.2789034,
0.282665979,
0.310667206,
0.304831145,
0.304359489,
0.308089904,
0.304928809]]],
["hash_ident_sym",
[[0.305813012,
0.303189703,
0.301997459,
0.300660626,
0.300163474,
0.301810958,
0.298706863,
0.311960511,
0.320109957,
0.302986946],
[0.32614618,
0.304887916,
0.315441648,
0.326258758,
0.324392301,
0.32748039,
0.325020528,
0.301887967,
0.302193528,
0.322104392]]],
["hash_keys",
[[0.237521622,
0.23922897,
0.238281437,
0.238138736,
0.237818849,
0.2378655,
0.237608242,
0.238036116,
0.236039937,
0.235813287],
[0.263477427,
0.258049086,
0.262820406,
0.258006327,
0.260327548,
0.258086656,
0.258101371,
0.261393187,
0.263826948,
0.263821759]]],
["hash_shift",
[[0.037325564,
0.037761812,
0.037403326,
0.036865859,
0.037000981,
0.037950627,
0.037680922,
0.037717904,
0.037626562,
0.036707708],
[0.03798574,
0.037781371,
0.037426497,
0.037792447,
0.037706575,
0.037963926,
0.036547303,
0.037862104,
0.037668743,
0.037850759]]],
["hash_values",
[[0.248007122,
0.249332361,
0.249889164,
0.249408139,
0.249554509,
0.24780729,
0.248163849,
0.249284379,
0.255694909,
0.249493122],
[0.255092865,
0.255601239,
0.258623913,
0.255917981,
0.254690221,
0.255258993,
0.259686026,
0.258781678,
0.25826431,
0.259851974]]],
["io_file_create",
[[1.149395899,
1.111947451,
1.148424115,
1.123299421,
1.078547687,
1.098754876,
1.094469825,
1.115538889,
1.087441845,
1.093890361],
[1.122687358,
1.134292887,
1.1001334,
1.10556303,
1.109311338,
1.117908214,
1.145130799,
1.112610468,
1.113446261,
1.104785981]]],
["io_file_read",
[[1.125019709,
1.13541136,
1.137872765,
1.134047156,
1.144845212,
1.129636485,
1.115561785,
1.137242899,
1.139068138,
1.162766904],
[1.15143518,
1.127682375,
1.154615488,
1.116836046,
1.11798176,
1.151602558,
1.124061101,
1.144359065,
1.126918446,
1.180646534]]],
["io_file_write",
[[0.776067606,
0.797726835,
0.778702876,
0.787620677,
0.77398871,
0.776857011,
0.781660664,
0.801027151,
0.784763445,
0.784689316],
[0.811236564,
0.880919813,
0.856910608,
0.803084827,
0.781769853,
0.780891689,
0.781802785,
0.786309619,
0.780036884,
0.809695371]]],
["io_select",
[[1.44421145,
1.500961778,
1.340275243,
1.333589151,
1.343530587,
1.388690989,
1.330531973,
1.352735683,
1.331536008,
1.334436513],
[1.326947365,
1.321638113,
1.40019153,
1.464163825,
1.35215768,
1.331160097,
1.325573937,
1.32871885,
1.394282438,
1.326135512]]],
["io_select2",
[[1.484366617,
1.519561653,
1.49992768,
1.678054688,
1.478214104,
1.690015728,
1.736267968,
1.519632113,
1.484009967,
1.498426631],
[1.477902349,
1.480356925,
1.510644959,
1.488792033,
1.491730639,
1.484534491,
1.474508188,
1.488224728,
1.479929293,
1.484428486]]],
["io_select3",
[[0.035239068,
0.035185953,
0.035496549,
0.035138319,
0.035191802,
0.035105515,
0.035467736,
0.035069739,
0.035290586,
0.035655578],
[0.035575096,
0.035514868,
0.035360184,
0.035532505,
0.035664328,
0.035364631,
0.035594935,
0.035676978,
0.035750193,
0.036109592]]],
["loop_for",
[[1.068398738,
1.089524688,
1.06515046,
1.076397493,
1.128322392,
1.056983289,
1.068786863,
1.06075239,
1.090364107,
1.05966495],
[1.070177283,
1.199340781,
1.046856599,
1.228460821,
1.055218017,
1.081184898,
1.446706991,
1.075304924,
1.091709721,
1.047952522]]],
["loop_generator",
[[0.69687891,
0.66540424,
0.679628263,
0.679925684,
0.668787193,
0.663496081,
0.675394757,
0.668240526,
0.664183383,
0.668584543],
[0.664589303,
0.664632547,
0.66494632,
0.66598414,
0.668229128,
0.703826444,
0.666750904,
0.696360115,
0.667385923,
0.664486322]]],
["loop_times",
[[0.980117059,
0.99439093,
0.979838402,
0.980894064,
0.976447361,
1.017838667,
0.982484037,
0.975619088,
0.994094528,
0.975998638],
[0.980488121,
1.012998277,
0.994445077,
1.021846043,
0.995144058,
0.980257679,
0.980164899,
0.982455737,
0.980923491,
0.995939417]]],
["loop_whileloop",
[[0.519354884,
0.51248877,
0.528460095,
0.572378986,
0.522353833,
0.512769352,
0.51291327,
0.513174436,
0.512962627,
0.512993475],
[0.512713733,
0.513168691,
0.513058356,
0.526820777,
0.597845519,
0.598345559,
0.513074299,
0.512725396,
0.512297872,
0.512275679]]],
["loop_whileloop2",
[[0.119143733,
0.119069969,
0.118170264,
0.119768966,
0.119649986,
0.119431425,
0.119271081,
0.117096695,
0.122974262,
0.119396226],
[0.119527968,
0.119188292,
0.119380972,
0.119252149,
0.119249809,
0.119733445,
0.119868804,
0.119451459,
0.119356097,
0.11951881]]],
["securerandom",
[[0.648002646,
0.616914537,
0.643030421,
0.642372636,
0.626927428,
0.625634949,
0.626575619,
0.638432885,
0.635409301,
0.672691913],
[0.621063098,
0.664200477,
0.628247305,
0.620684543,
0.623475494,
0.623570129,
0.621391886,
0.62354543,
0.615683188,
0.639126611]]],
["so_ackermann",
[[0.554878476,
0.55431934,
0.554912154,
0.554768344,
0.554965378,
0.555051582,
0.555390224,
0.561993,
0.554681063,
0.554925765],
[0.555434009,
0.5543861,
0.555613879,
0.562025374,
0.567785032,
0.555452116,
0.554703316,
0.554925696,
0.554846137,
0.555057477]]],
["so_array",
[[0.716432331,
0.715614862,
0.718187026,
0.715615418,
0.716560232,
0.719680592,
0.716808351,
0.715400045,
0.717318291,
0.716128422],
[0.722933867,
0.723459141,
1.01009105,
1.05958547,
0.723921387,
1.018041186,
0.820268848,
0.728892185,
0.728845082,
0.726623785]]],
["so_binary_trees",
[[5.891852595,
5.85857463,
5.886513007,
5.904337825,
6.007118055,
5.832122029,
5.817885089,
5.865527204,
6.11444961,
5.900852034],
[5.841628543,
5.848832941,
5.842604198,
5.816352106,
5.914531149,
5.821454501,
5.864819026,
5.82034879,
5.78314775,
5.96197454]]],
["so_concatenate",
[[3.145572464,
3.14750577,
3.152418716,
3.661567167,
3.183339491,
3.170945435,
3.388805977,
3.156055341,
3.357375794,
3.14938203],
[3.131218652,
3.163337176,
3.204333685,
3.121685686,
3.129380278,
3.122056144,
3.124002248,
3.140635879,
3.220535497,
3.169139827]]],
["so_count_words",
[[0.242391291,
0.239844531,
0.239700652,
0.240641664,
0.240109531,
0.241933466,
0.239628769,
0.239354057,
0.240767827,
0.220111057],
[0.197886702,
0.197439675,
0.197293019,
0.199392232,
0.198683854,
0.197303157,
0.197314665,
0.197404594,
0.19820777,
0.197466916]]],
["so_exception",
[[0.27459704,
0.282408741,
0.279051681,
0.276141397,
0.279595338,
0.274870568,
0.286747379,
0.27522475,
0.29289278,
0.278606696],
[0.296178192,
0.275072498,
0.27512703,
0.275032342,
0.275854473,
0.27558595,
0.273236387,
0.278263372,
0.280499338,
0.290462425]]],
["so_fannkuch",
[[0.99656016,
0.997722458,
0.993261332,
1.012012197,
1.032322957,
0.998555259,
0.9905474,
0.98366331,
1.018624582,
1.027585325],
[0.993587482,
1.029757339,
1.021017374,
0.997894093,
1.008250871,
1.012816448,
1.037534666,
1.006494168,
0.991196374,
1.051552952]]],
["so_fasta",
[[1.626379653,
1.604243419,
1.608287118,
1.610960882,
1.619263969,
1.659891248,
1.606374795,
1.612020157,
1.667336899,
1.617827365],
[1.861029118,
1.596523452,
1.605929241,
1.603162676,
1.617902462,
1.596778535,
1.747227256,
1.624631813,
1.596906256,
1.594713807]]],
["so_k_nucleotide",
[[1.004566888,
1.000403766,
1.013398124,
1.008655269,
1.004949563,
1.007553872,
1.00565489,
1.006228219,
0.999932032,
1.280733682],
[1.006863257,
1.010804323,
1.006856365,
1.021802051,
1.002110227,
1.013540483,
1.007242235,
1.012412313,
1.008362609,
1.009553163]]],
["so_lists",
[[0.4544042,
0.456157268,
0.46296676,
0.46579061,
0.455299073,
0.491072223,
0.457926713,
0.45763858,
0.45776412,
0.455454856],
[0.456382284,
0.457859992,
0.456136711,
0.458060569,
0.456410862,
0.456431534,
0.457381009,
0.456965826,
0.45614831,
0.455747519]]],
["so_mandelbrot",
[[1.979842828,
1.986014054,
2.023256356,
1.990052777,
2.004414585,
1.989482749,
2.00374384,
2.005260208,
1.973930571,
2.013561508],
[1.983405369,
1.986018375,
1.981057158,
1.990895433,
1.998027297,
1.980012879,
2.000246329,
1.988311323,
2.068660796,
1.988520077]]],
["so_matrix",
[[0.500874477,
0.484887281,
0.508492887,
0.49274288,
0.499600926,
0.533587423,
0.537606671,
0.494616717,
0.486548428,
0.487992105],
[0.488608283,
0.492753145,
0.489930145,
0.492269239,
0.510433561,
0.490049011,
0.501774228,
0.509093734,
0.498486931,
0.491265322]]],
["so_meteor_contest",
[[2.64489358,
2.665539128,
2.620766875,
2.64559136,
2.667070644,
2.615702788,
2.634790016,
2.676334988,
2.629919232,
2.617883585],
[2.643250652,
2.655673084,
2.689109941,
2.819435765,
2.656473882,
2.683216279,
2.725329669,
2.646512151,
2.651052236,
2.651709693]]],
["so_nbody",
[[1.205101985,
1.213859787,
1.205128418,
1.391464894,
1.326758401,
1.199627727,
1.45721871,
1.208749139,
1.199151646,
1.200151241],
[1.20549877,
1.237723323,
1.204646758,
1.199548993,
1.195648843,
1.198679314,
1.197062663,
1.210142232,
1.243288638,
1.319684736]]],
["so_nested_loop",
[[0.884004457,
0.905090802,
0.871943968,
0.870676388,
0.908360449,
0.932598348,
1.059668395,
1.26015312,
0.870940727,
0.885396989],
[0.887870576,
1.171482791,
0.908446414,
0.88783285,
0.877407234,
0.92061022,
0.869538448,
0.896780013,
0.896127852,
0.875915198]]],
["so_nsieve",
[[1.433350772,
1.422841423,
1.434855136,
1.422749093,
1.424615379,
1.445042906,
1.433590631,
1.426340732,
1.419519729,
1.422578648],
[1.435229006,
1.436386252,
1.454652324,
1.43760086,
1.432428185,
1.434775625,
1.439618084,
1.459607035,
1.439808637,
1.442253853]]],
["so_nsieve_bits",
[[1.885272314,
1.894371983,
1.881578513,
2.282154784,
1.970788897,
1.88036627,
1.917455219,
1.880669436,
1.880472597,
1.929477201],
[1.98571179,
1.909510103,
1.885918757,
1.886175113,
1.936036665,
1.884183483,
1.936353317,
1.886282141,
1.936303274,
1.886593089]]],
["so_object",
[[0.58789362,
0.59184246,
0.587967287,
0.588134718,
0.589231962,
0.600176239,
0.587345601,
0.589692602,
0.590391874,
0.588790516],
[0.617989568,
0.599776789,
0.600555451,
0.599688356,
0.636933354,
0.917953399,
0.602737827,
0.599820535,
0.599344116,
0.601595503]]],
["so_partial_sums",
[[1.880699844,
1.885463321,
1.871235188,
1.776139242,
1.768804882,
1.813928255,
1.798474237,
1.769855196,
1.772887237,
1.774969887],
[1.755212649,
1.765916881,
1.753125487,
1.793198484,
1.754066969,
1.756901637,
1.75644061,
1.791233392,
1.972476254,
1.884114605]]],
["so_pidigits",
[[0.957060099,
0.957411888,
0.963470988,
0.958903022,
0.967337511,
0.962384705,
0.958645076,
0.95770352,
0.955135655,
0.961775851],
[0.9429389,
0.943606296,
0.949029438,
0.943701328,
0.944859347,
0.942171759,
0.941467939,
0.943824571,
0.94144008,
0.947744497]]],
["so_random",
[[0.360077426,
0.359104098,
0.359018956,
0.359092032,
0.359331325,
0.359019006,
0.357936676,
0.359091978,
0.358985498,
0.363673247],
[0.362823285,
0.381718629,
0.363027573,
0.363395545,
0.365067534,
0.363031422,
0.363099171,
0.363026419,
0.36262485,
0.363246354]]],
["so_reverse_complement",
[[1.19546514,
1.183278023,
1.212173001,
1.087653349,
1.20140735,
1.183987459,
1.196346604,
1.186763176,
1.094528627,
1.189048228],
[1.141821171,
1.142904285,
1.178747042,
1.181916333,
1.154907879,
1.214846227,
1.151054146,
1.185621045,
1.189607442,
1.215448142]]],
["so_sieve",
[[0.470463395,
0.463910925,
0.464827161,
0.463764632,
0.464697532,
0.463857276,
0.464311539,
0.477877842,
0.463772041,
0.464269611],
[0.469503609,
0.469179384,
0.469393566,
0.469894459,
0.469383854,
0.468934437,
0.469077631,
0.469599363,
0.469048302,
0.470137266]]],
["so_spectralnorm",
[[1.776248853,
1.734098752,
1.726329029,
1.717729015,
1.723574111,
1.858471666,
1.738485008,
1.71906145,
1.717009932,
1.739294577],
[1.723627502,
1.727801841,
1.732547779,
1.721272043,
1.720609006,
1.719929987,
1.724219175,
1.892292358,
1.879054572,
1.765989043]]],
["vm1_attr_ivar",
[[1.326750513,
1.281467312,
1.341676341,
1.154036421,
1.088513305,
1.362177061,
1.237257317,
1.186542107,
1.202354104,
1.087300805],
[1.089515037,
1.096151008,
1.095826107,
1.09110839,
1.08988974,
1.086924157,
1.08689725,
1.087652692,
1.086958201,
1.086968367]]],
["vm1_attr_ivar_set",
[[1.406125838,
1.420390519,
1.410263949,
1.456576401,
1.453218966,
1.412157335,
1.420401316,
1.406924099,
1.411840276,
1.408635788],
[1.413086011,
1.410921039,
1.515902883,
1.42461814,
1.49368099,
1.593859797,
1.731580157,
1.536495996,
1.59667807,
1.40971823]]],
["vm1_block",
[[2.004619915,
1.984161039,
2.000238866,
1.994394683,
1.986587118,
2.027757692,
2.048867635,
1.981987365,
1.986718518,
2.049096827],
[1.985284802,
2.076749991,
1.987910221,
1.994191389,
1.988661818,
1.986830653,
2.16810906,
1.990068097,
2.424476009,
2.438980967]]],
["vm1_const",
[[0.724011415,
0.751993343,
0.828428348,
0.724765577,
0.723729441,
0.876904781,
0.762510992,
0.727887555,
0.724300319,
0.723454546],
[0.720973701,
0.721035578,
0.721423021,
0.721296312,
0.721248332,
0.724508718,
0.720067769,
0.721091193,
0.720684421,
0.720590542]]],
["vm1_ensure",
[[0.510265405,
0.511039576,
0.510855647,
0.510571646,
0.510487244,
0.510646966,
0.510903815,
0.511170774,
0.510245093,
0.510242364],
[0.513740223,
0.513880149,
0.513927762,
0.513652705,
0.513784976,
0.513959367,
0.513939594,
0.513989961,
0.513810522,
0.513645247]]],
["vm1_float_simple",
[[4.352794815,
4.427100234,
4.357426692,
4.242957955,
5.749445486,
4.861683109,
4.611913164,
4.248991524,
4.310098038,
4.331423845],
[4.40533171,
4.385436746,
4.539163247,
4.451554309,
5.371444941,
5.058826984,
4.394677752,
4.399262148,
4.622233003,
4.341218332]]],
["vm1_gc_short_lived",
[[9.299003918,
9.607103822,
9.52348325,
9.351952746,
9.166694274,
9.154672515,
9.241831242,
9.222188708,
9.097087049,
9.083368277],
[8.979892772,
8.948615418,
8.94358949,
8.977953226,
8.930222551,
8.966036805,
9.165879242,
9.162806971,
8.928880773,
8.908029302]]],
["vm1_gc_short_with_complex_long",
[[10.979590732,
11.069026647,
10.989757024,
10.980927352,
10.92604894,
11.045978772,
11.032459172,
10.968647442,
11.022738346,
11.050070382],
[11.108989548,
10.895239351,
10.893372779,
11.098307264,
11.264270621,
10.939747221,
10.948628476,
10.922754727,
10.989071546,
10.884562285]]],
["vm1_gc_short_with_long",
[[9.85388492,
9.862436618,
9.853143666,
9.876420308,
9.895540064,
9.900466407,
9.851785308,
9.893819847,
9.875527071,
9.904952073],
[9.738025396,
9.719086171,
10.183026952,
9.74686711,
9.719312983,
9.702301885,
9.735284114,
9.763578466,
9.721462461,
9.747227936]]],
["vm1_gc_short_with_symbol",
[[9.50395045,
9.584649781,
9.719530802,
9.594610927,
9.338013872,
9.403705508,
10.788435743,
9.423518406,
10.013764648,
9.570680255],
[9.208967684,
9.382788648,
9.32592605,
9.214151825,
9.212628448,
9.275158815,
9.382481485,
9.387072921,
9.167268354,
9.494654659]]],
["vm1_gc_wb_ary",
[[1.147797702,
1.07551601,
1.083096096,
1.074741102,
1.075512916,
1.087115413,
1.075316172,
1.077487324,
1.075465058,
1.075222562],
[1.064514195,
1.065066605,
1.067178167,
1.06696848,
1.104947844,
1.0698162,
1.067390951,
1.065605883,
1.14866906,
1.085749239]]],
["vm1_gc_wb_obj",
[[1.065491155,
1.339934267,
1.126352377,
1.118274006,
1.121598522,
1.0945944,
1.299849679,
1.126306965,
1.051445321,
1.359615822],
[1.529405906,
1.061978983,
1.059987439,
1.056625144,
1.061240029,
1.058547356,
1.064332586,
1.06430658,
1.284736673,
1.081213917]]],
["vm1_ivar",
[[0.732845415,
0.736293149,
0.771818895,
0.840215944,
0.756953726,
0.73349172,
0.732729929,
0.732720846,
0.732638614,
0.733124223],
[0.733305094,
0.73316103,
0.733085095,
0.73311374,
0.733009473,
0.740021408,
0.733247148,
0.733161471,
0.733154861,
0.733016812]]],
["vm1_ivar_set",
[[0.906701623,
0.90271781,
0.891999967,
0.890021645,
0.897370889,
0.888535227,
0.956963337,
0.912073158,
1.346196183,
0.966576753],
[1.12214036,
0.964292539,
1.021842033,
1.282939856,
1.159691711,
1.361047186,
0.922545639,
1.003385877,
1.263600194,
0.93657982]]],
["vm1_length",
[[0.919564573,
0.923974728,
0.920407549,
0.920451743,
0.920319989,
0.920456607,
0.920767013,
0.920226718,
0.920368093,
0.920341266],
[0.92076659,
0.920485496,
0.920565386,
1.26941394,
0.920474983,
0.92038875,
0.920444582,
0.9203879,
0.923340819,
0.921364909]]],
["vm1_lvar_init",
[[1.71203098,
1.708061695,
1.933030959,
1.814921006,
2.065309732,
1.733509022,
1.780352332,
2.16590027,
1.783162329,
2.626269635],
[2.558632335,
1.861565075,
2.577726662,
2.631456942,
1.827923592,
1.702482632,
1.71663206,
1.754538343,
1.696627162,
1.691055796]]],
["vm1_lvar_set",
[[2.475366347,
2.473178776,
2.476519503,
2.476033007,
2.475486809,
2.473323796,
2.517870031,
2.625114464,
2.484786033,
2.596214747],
[2.526130626,
2.610164374,
2.88131717,
2.851746956,
2.762483063,
2.472280032,
2.472686528,
2.472592859,
2.47240747,
2.473508289]]],
["vm1_neq",
[[0.968142968,
0.954512479,
0.955811063,
0.954303277,
1.058883621,
1.009745469,
0.990800628,
1.049664067,
1.161817696,
1.632842791],
[1.121360525,
0.95798036,
0.9535098,
1.343705833,
0.975003782,
0.959950174,
1.339184229,
1.218822788,
0.959301719,
0.988312683]]],
["vm1_not",
[[1.058006785,
0.894977125,
0.74971253,
0.999090716,
1.080774049,
0.980370634,
0.779352881,
0.748725214,
0.7492704,
0.791591259],
[0.760867522,
0.817209155,
0.765411921,
0.750915306,
1.016355917,
0.803063321,
0.781027784,
0.898436709,
0.793891822,
0.785001297]]],
["vm1_rescue",
[[0.614962557,
0.618616117,
0.627111337,
0.62586782,
0.754401771,
0.854392256,
0.686720247,
0.613991738,
0.613965382,
0.615000411],
[0.616104035,
0.633980773,
0.625831908,
0.634039862,
0.614295319,
0.614046736,
0.613890434,
0.613880872,
0.613995646,
0.613880132]]],
["vm1_simplereturn",
[[1.226309989,
1.387738832,
1.256992291,
1.24285113,
1.225559321,
1.223404655,
1.224599234,
1.226168386,
1.226112643,
1.225337169],
[1.248849294,
1.225427281,
1.222688858,
1.222109651,
1.222273327,
1.221765554,
1.222243693,
1.370048617,
1.344156583,
1.226515337]]],
["vm1_swap",
[[0.730301752,
0.731396407,
0.83343086,
0.728030834,
0.89796579,
1.000808575,
0.999893291,
0.896495108,
0.730830802,
0.727731168],
[0.727961825,
0.773433632,
0.743611846,
0.945669505,
0.944430407,
0.942770799,
0.943226399,
0.783553899,
0.726884758,
0.726973646]]],
["vm1_yield",
[[1.17570019,
1.229845265,
1.400185349,
1.321732851,
1.258243122,
2.123445381,
1.724213478,
1.478238257,
1.205834779,
1.176394306],
[1.228914764,
1.188647615,
1.19757616,
1.360537121,
1.180653906,
1.24975019,
1.3785968,
1.231586966,
1.234262815,
1.247705207]]],
["vm2_array",
[[0.73824619,
0.737371085,
0.807479761,
0.744885591,
0.747952004,
0.743777795,
0.736196617,
0.738309815,
0.737062439,
0.750747667],
[0.771446239,
0.757887449,
0.738576221,
0.809367362,
0.755662815,
0.740865405,
0.745320753,
0.772665581,
0.7367682,
0.771393985]]],
["vm2_bigarray",
[[6.686484237,
6.708665217,
6.715444231,
6.728438973,
6.699407643,
6.773321832,
6.731451273,
6.768405943,
6.957647974,
6.8823709],
[6.990485803,
6.85722822,
7.04176214,
7.059733317,
7.042386024,
6.891391669,
6.73829468,
7.213554228,
6.951761117,
6.957400362]]],
["vm2_bighash",
[[4.20879843,
3.910994204,
3.840111163,
3.840781478,
3.850745917,
3.878929864,
3.888859114,
3.832355612,
3.851203777,
3.805135264],
[3.321646569,
3.357736691,
3.289268425,
3.348414717,
3.475979835,
3.494052154,
3.397488885,
3.36792594,
3.363455023,
3.312310045]]],
["vm2_case",
[[0.196835984,
0.195341766,
0.195162702,
0.194332785,
0.195400058,
0.198119613,
0.197866245,
0.198764721,
0.19691054,
0.194426193],
[0.201035104,
0.195909645,
0.196587409,
0.197526548,
0.197254119,
0.197333349,
0.199120289,
0.207097861,
0.203300542,
0.197628782]]],
["vm2_defined_method",
[[2.740640336,
2.716431221,
2.724859599,
2.933273936,
2.744307799,
2.961672792,
2.737026437,
2.728455237,
2.869693445,
2.996770567],
[2.768419434,
3.020252934,
2.97175786,
3.021297248,
2.931910307,
3.07090447,
3.115585193,
3.166649582,
2.782318973,
3.001319958]]],
["vm2_dstr",
[[1.273185868,
1.267542551,
1.256862391,
1.256289059,
1.253628018,
1.255953478,
1.256287732,
1.275573216,
1.253663501,
1.253545566],
[1.258879865,
1.259996063,
1.317688224,
1.314313777,
1.376796101,
1.261548187,
1.277180761,
1.382023106,
1.256838963,
1.259226783]]],
["vm2_eval",
[[13.490363308,
13.391284216,
13.319809015,
13.563180888,
13.459640705,
13.703297321,
13.490092353,
13.647006588,
13.314201223,
13.335290271],
[13.489244819,
13.464344185,
13.386064361,
13.800102224,
13.449417796,
13.529014087,
13.403679597,
13.395622618,
13.531325513,
13.378471666]]],
["vm2_method",
[[1.497883019,
1.349596421,
1.383327376,
1.394124626,
1.359510367,
1.414043155,
1.36793866,
1.37444144,
1.372978551,
1.394028008],
[1.391830038,
1.393725073,
1.363125867,
1.34614657,
1.38511985,
1.367251947,
1.351907635,
1.346439619,
1.371228239,
1.345467984]]],
["vm2_method_missing",
[[1.932546917,
1.934455679,
1.93854172,
1.950912021,
1.976581969,
1.942608988,
1.945635695,
1.949595676,
1.937782962,
1.940176255],
[1.922861442,
1.979757776,
2.009199031,
2.084504719,
2.006731683,
2.170731467,
1.925568209,
1.933497754,
1.958627951,
2.023735618]]],
["vm2_method_with_block",
[[1.535500009,
1.534057029,
1.529463316,
1.532181882,
1.526631008,
1.526960027,
1.537940015,
1.550714434,
1.532147733,
1.525579625],
[1.538325067,
1.521428564,
1.520290731,
1.539246577,
1.521422425,
1.528081874,
1.52097376,
1.518730775,
1.536835565,
1.572949428]]],
["vm2_mutex",
[[0.739153718,
0.758694072,
0.72497689,
0.722191234,
0.773226641,
0.720953542,
0.7228843,
0.729210501,
0.767927142,
0.725675294],
[0.727837451,
0.731015119,
0.725992194,
0.722904121,
0.723316265,
0.730713471,
0.727438374,
0.725525296,
0.724396052,
0.768241676]]],
["vm2_newlambda",
[[0.822555793,
0.832994932,
0.882269455,
0.820697696,
0.822728876,
0.821214081,
0.868972823,
0.870471792,
0.821473512,
0.821745978],
[0.829513172,
0.873588178,
0.828993038,
0.824177145,
0.828011442,
0.824918656,
0.84767392,
0.826742896,
0.839770483,
0.843395494]]],
["vm2_poly_method",
[[2.326237859,
2.266256095,
2.235942037,
2.288210056,
2.274665021,
2.248117362,
2.258712091,
2.221985868,
2.23021852,
2.311983839],
[2.223783136,
2.258611694,
2.257393307,
2.334440796,
2.557367006,
2.23185053,
2.237156024,
2.232835424,
2.239021717,
2.726531501]]],
["vm2_poly_method_ov",
[[0.275886321,
0.305978652,
0.275437115,
0.275531912,
0.350827979,
0.293155119,
0.319846569,
0.302610138,
0.296192913,
0.301054013],
[0.289516981,
0.274331768,
0.274466841,
0.273935342,
0.273578254,
0.2764675,
0.276368437,
0.2862352,
0.282155416,
0.286209383]]],
["vm2_proc",
[[0.487605351,
0.492358452,
0.490108473,
0.496589868,
0.494560116,
0.532761958,
0.609371968,
0.498319369,
0.490103889,
0.735836153],
[0.507268309,
0.493875729,
0.50110458,
0.525028376,
0.501418531,
0.498359718,
0.688990206,
0.505072285,
0.497818643,
0.54148073]]],
["vm2_raise1",
[[5.311127359,
5.390314221,
5.328343583,
5.562379409,
6.844047389,
5.57739729,
5.384502289,
5.73890192,
5.237066776,
5.615761964],
[5.503445093,
5.225865177,
5.438818665,
5.64426263,
5.324782953,
5.381946793,
5.678803147,
5.310660225,
5.642545241,
5.345868388]]],
["vm2_raise2",
[[7.692413838,
7.696555486,
7.992847615,
7.810899032,
7.788691128,
8.124372478,
7.926554513,
7.738638769,
7.727894361,
7.775751114],
[7.88410877,
7.776840742,
7.842858133,
7.724970863,
8.025117301,
7.785907733,
7.732682048,
7.812724216,
10.516519054,
8.221834305]]],
["vm2_regexp",
[[1.268980275,
1.201561586,
1.28761712,
1.174532139,
1.176820961,
1.177446994,
1.191394707,
1.213051569,
1.229802049,
1.199717933],
[1.406724093,
1.873657512,
1.235636588,
1.180592023,
1.180405011,
1.179492048,
1.179240929,
1.178992879,
1.179920336,
1.178143189]]],
["vm2_send",
[[0.375499778,
0.375399703,
0.375428611,
0.375318016,
0.391465056,
0.375391269,
0.379284615,
0.375393927,
0.375227137,
0.375061281],
[0.38743732,
0.37392435,
0.384839361,
0.374891749,
0.381980701,
0.399061969,
0.375260479,
0.424430882,
0.649389972,
0.658862578]]],
["vm2_super",
[[0.958544917,
0.95822058,
0.819465865,
0.499026628,
0.499177863,
0.499600332,
0.500004225,
0.501529214,
0.500463355,
0.499805492],
[0.507933667,
0.496059393,
0.516503062,
0.499936802,
0.504115618,
0.497044931,
0.525926702,
0.520227426,
0.497140025,
0.496479982]]],
["vm2_unif1",
[[0.276554421,
0.272975708,
0.272853563,
0.281795113,
0.27296358,
0.272952064,
0.275852591,
0.272725647,
0.272893154,
0.272895589],
[0.27322529,
0.273127852,
0.273053935,
0.272907013,
0.273236757,
0.28468084,
0.315127313,
0.291731107,
0.286106583,
0.273239757]]],
["vm2_zsuper",
[[0.514349501,
0.519724578,
0.516974954,
0.514313814,
0.515758378,
0.514475406,
0.827379433,
0.514494908,
0.526002028,
0.853725532],
[0.51739732,
0.51495405,
0.546691061,
0.54049117,
0.644810826,
0.751828834,
0.588514948,
0.518992833,
0.512499102,
0.559811508]]],
["vm3_backtrace",
[[0.144840928,
0.142657391,
0.142533026,
0.145085188,
0.142756092,
0.144094462,
0.146588816,
0.148375788,
0.140469535,
0.141194009],
[0.141713494,
0.143726215,
0.141439089,
0.14475942,
0.144933465,
0.144800219,
0.143130206,
0.141121701,
0.141097222,
0.143603039]]],
["vm3_clearmethodcache",
[[0.404271737,
0.39266564,
0.391837834,
0.391336176,
0.393378964,
0.395533111,
0.392877222,
0.400904708,
0.392621967,
0.390293488],
[0.395890107,
0.413310319,
0.419650327,
0.399710606,
0.392865163,
0.39254773,
0.398473421,
0.39348053,
0.395670151,
0.392723628]]],
["vm3_gc",
[[2.115529024,
2.116169962,
2.140990368,
2.117888375,
2.107327782,
2.117847576,
2.107726879,
2.113756236,
2.098598614,
2.108233376],
[2.236541119,
2.141630102,
2.106511716,
2.124389434,
2.112392234,
2.163199193,
2.186435535,
2.116584433,
2.112300412,
2.108126997]]],
["vm_thread_alive_check1",
[[40.654424318,
40.591822222,
40.703927842,
40.672611947,
40.630475949,
40.623682078,
40.581170949,
40.58866893,
40.600151628,
40.600728054],
[40.587726318,
40.626521683,
40.671568378,
40.649703953,
40.666439782,
40.538390481,
40.662454896,
40.54273179,
40.494787422,
40.664949354]]],
["vm_thread_close",
[[3.450554812,
3.287614932,
3.252715753,
3.3008256,
3.381139325,
3.333134435,
3.250352337,
3.267024248,
3.238626588,
3.289960887],
[3.266113851,
3.280930809,
3.366264585,
3.271376227,
3.264973628,
3.304123725,
3.173035934,
3.208949451,
3.326825231,
3.395628869]]],
["vm_thread_create_join",
[[2.372775092,
2.352637844,
2.262079765,
2.210738934,
2.205987859,
2.407110532,
2.173356132,
2.299178228,
2.229149612,
2.259245285],
[2.224398723,
2.226041684,
2.300789101,
2.338296881,
2.296278624,
2.266404719,
2.452862553,
2.351395609,
2.283968555,
2.206752758]]],
["vm_thread_mutex1",
[[0.635522283,
0.554123253,
0.549552467,
0.549268984,
0.553543827,
0.622636518,
0.806108278,
0.548406001,
0.888223943,
0.691999112],
[0.544612135,
0.545474615,
0.546425162,
0.545381385,
0.554829948,
0.544843098,
0.54496311,
0.544434742,
0.544592759,
0.545839255]]],
["vm_thread_mutex2",
[[0.572128297,
0.576332316,
0.566920123,
0.569185976,
0.573532211,
0.56833157,
0.573200064,
0.572925775,
0.567218244,
0.581709838],
[0.563911666,
0.563880294,
0.566890233,
0.570359346,
0.578911669,
0.563852429,
0.565207214,
0.567358572,
0.562909605,
0.569521178]]],
["vm_thread_mutex3",
[[0.663592438,
0.666536385,
0.659510603,
0.661673613,
0.66269806,
0.658988787,
0.66322222,
0.661411552,
0.663641136,
0.661921818],
[0.660929972,
0.661353911,
0.657409355,
0.659650624,
0.66193297,
0.655136509,
0.667381205,
0.658995725,
0.66134587,
0.660455218]]],
["vm_thread_pass",
[[0.161549537,
0.159608209,
0.161272874,
0.161757052,
0.161021168,
0.160855899,
0.15835622,
0.161532774,
0.160570638,
0.158302028],
[0.161657228,
0.162963641,
0.159081461,
0.159694397,
0.160830294,
0.161074473,
0.158827159,
0.158503613,
0.158143838,
0.159628808]]],
["vm_thread_pass_flood",
[[0.070448288,
0.070411529,
0.068074827,
0.067710877,
0.068247412,
0.071154337,
0.067616512,
0.067798783,
0.06819606,
0.068222427],
[0.068969975,
0.06837987,
0.069892416,
0.06827312,
0.067956212,
0.070335651,
0.068206125,
0.068747337,
0.068304718,
0.06845048]]],
["vm_thread_pipe",
[[0.196192101,
0.227110165,
0.226758843,
0.220738313,
0.222194424,
0.221554786,
0.234592994,
0.224196739,
0.223174755,
0.227651556],
[0.221975245,
0.22863621,
0.217473043,
0.194895273,
0.218700974,
0.21848605,
0.223427233,
0.220396526,
0.218585784,
0.222415907]]],
["vm_thread_queue",
[[0.113205297,
0.113119815,
0.114581367,
0.11611283,
0.112890154,
0.112730259,
0.114046619,
0.112805781,
0.113794639,
0.113357915],
[0.111633923,
0.11191329,
0.112479745,
0.112423343,
0.11282222,
0.111614273,
0.11187231,
0.112063403,
0.112616271,
0.112089954]]]]
Elapsed time: 7017.674126986 (sec)
-----------------------------------------------------------
benchmark results:
minimum results in each 10 measurements.
Execution time (sec)
name orig stll
app_answer 0.054 0.054
app_aobench 42.964 42.731
app_erb 0.871 0.867
app_factorial 0.805 0.752
app_fib 0.474 0.476
app_lc_fizzbuzz 65.788 63.876
app_mandelbrot 0.898 0.891
app_pentomino 13.450 13.542
app_raise 0.255 0.256
app_strconcat 0.955 0.927
app_tak 0.663 0.662
app_tarai 0.550 0.547
app_uri 0.679 0.659
hash_aref_miss 0.418 0.434
hash_aref_str 0.404 0.396
hash_aref_sym 0.608 0.612
hash_aref_sym_long 1.370 1.391
hash_flatten 0.408 0.419
hash_ident_num 0.282 0.283
hash_ident_obj 0.278 0.280
hash_ident_str 0.278 0.279
hash_ident_sym 0.299 0.302
hash_keys 0.236 0.258
hash_shift 0.037 0.037
hash_values 0.248 0.255
io_file_create 1.079 1.100
io_file_read 1.116 1.117
io_file_write 0.774 0.780
io_select 1.331 1.322
io_select2 1.478 1.475
io_select3 0.035 0.035
loop_for 1.057 1.047
loop_generator 0.663 0.664
loop_times 0.976 0.980
loop_whileloop 0.512 0.512
loop_whileloop2 0.117 0.119
securerandom 0.617 0.616
so_ackermann 0.554 0.554
so_array 0.715 0.723
so_binary_trees 5.818 5.783
so_concatenate 3.146 3.122
so_count_words 0.220 0.197
so_exception 0.275 0.273
so_fannkuch 0.984 0.991
so_fasta 1.604 1.595
so_k_nucleotide 1.000 1.002
so_lists 0.454 0.456
so_mandelbrot 1.974 1.980
so_matrix 0.485 0.489
so_meteor_contest 2.616 2.643
so_nbody 1.199 1.196
so_nested_loop 0.871 0.870
so_nsieve 1.420 1.432
so_nsieve_bits 1.880 1.884
so_object 0.587 0.599
so_partial_sums 1.769 1.753
so_pidigits 0.955 0.941
so_random 0.358 0.363
so_reverse_complement 1.088 1.142
so_sieve 0.464 0.469
so_spectralnorm 1.717 1.720
vm1_attr_ivar* 0.575 0.575
vm1_attr_ivar_set* 0.894 0.897
vm1_block* 1.469 1.473
vm1_const* 0.211 0.208
vm1_ensure* 0.000 0.001
vm1_float_simple* 3.730 3.829
vm1_gc_short_lived* 8.571 8.396
vm1_gc_short_with_complex_long* 10.414 10.372
vm1_gc_short_with_long* 9.339 9.190
vm1_gc_short_with_symbol* 8.826 8.655
vm1_gc_wb_ary* 0.562 0.552
vm1_gc_wb_obj* 0.539 0.544
vm1_ivar* 0.220 0.221
vm1_ivar_set* 0.376 0.410
vm1_length* 0.407 0.408
vm1_lvar_init* 1.196 1.179
vm1_lvar_set* 1.961 1.960
vm1_neq* 0.442 0.441
vm1_not* 0.236 0.239
vm1_rescue* 0.101 0.102
vm1_simplereturn* 0.711 0.709
vm1_swap* 0.215 0.215
vm1_yield* 0.663 0.668
vm2_array* 0.619 0.618
vm2_bigarray* 6.569 6.619
vm2_bighash* 3.688 3.170
vm2_case* 0.077 0.077
vm2_defined_method* 2.599 2.649
vm2_dstr* 1.136 1.138
vm2_eval* 13.197 13.259
vm2_method* 1.232 1.226
vm2_method_missing* 1.815 1.804
vm2_method_with_block* 1.408 1.400
vm2_mutex* 0.604 0.604
vm2_newlambda* 0.704 0.705
vm2_poly_method* 2.105 2.105
vm2_poly_method_ov* 0.158 0.154
vm2_proc* 0.371 0.375
vm2_raise1* 5.120 5.107
vm2_raise2* 7.575 7.606
vm2_regexp* 1.057 1.059
vm2_send* 0.258 0.255
vm2_super* 0.382 0.377
vm2_unif1* 0.156 0.154
vm2_zsuper* 0.397 0.393
vm3_backtrace 0.140 0.141
vm3_clearmethodcache 0.390 0.393
vm3_gc 2.099 2.107
vm_thread_alive_check1 40.581 40.495
vm_thread_close 3.239 3.173
vm_thread_create_join 2.173 2.207
vm_thread_mutex1 0.548 0.544
vm_thread_mutex2 0.567 0.563
vm_thread_mutex3 0.659 0.655
vm_thread_pass 0.158 0.158
vm_thread_pass_flood 0.068 0.068
vm_thread_pipe 0.196 0.195
vm_thread_queue 0.113 0.112
Speedup ratio: compare with the result of `orig' (greater is better)
name stll
app_answer 0.998
app_aobench 1.005
app_erb 1.004
app_factorial 1.070
app_fib 0.996
app_lc_fizzbuzz 1.030
app_mandelbrot 1.009
app_pentomino 0.993
app_raise 0.998
app_strconcat 1.030
app_tak 1.001
app_tarai 1.005
app_uri 1.030
hash_aref_miss 0.964
hash_aref_str 1.019
hash_aref_sym 0.994
hash_aref_sym_long 0.985
hash_flatten 0.972
hash_ident_num 0.997
hash_ident_obj 0.994
hash_ident_str 0.996
hash_ident_sym 0.989
hash_keys 0.914
hash_shift 1.004
hash_values 0.973
io_file_create 0.980
io_file_read 0.999
io_file_write 0.992
io_select 1.007
io_select2 1.003
io_select3 0.992
loop_for 1.010
loop_generator 0.999
loop_times 0.995
loop_whileloop 1.000
loop_whileloop2 0.982
securerandom 1.002
so_ackermann 1.000
so_array 0.990
so_binary_trees 1.006
so_concatenate 1.008
so_count_words 1.116
so_exception 1.005
so_fannkuch 0.992
so_fasta 1.006
so_k_nucleotide 0.998
so_lists 0.997
so_mandelbrot 0.997
so_matrix 0.992
so_meteor_contest 0.990
so_nbody 1.003
so_nested_loop 1.001
so_nsieve 0.991
so_nsieve_bits 0.998
so_object 0.980
so_partial_sums 1.009
so_pidigits 1.015
so_random 0.987
so_reverse_complement 0.953
so_sieve 0.989
so_spectralnorm 0.998
vm1_attr_ivar* 1.000
vm1_attr_ivar_set* 0.996
vm1_block* 0.998
vm1_const* 1.015
vm1_ensure* 0.000
vm1_float_simple* 0.974
vm1_gc_short_lived* 1.021
vm1_gc_short_with_complex_long* 1.004
vm1_gc_short_with_long* 1.016
vm1_gc_short_with_symbol* 1.020
vm1_gc_wb_ary* 1.018
vm1_gc_wb_obj* 0.990
vm1_ivar* 0.997
vm1_ivar_set* 0.917
vm1_length* 0.997
vm1_lvar_init* 1.014
vm1_lvar_set* 1.000
vm1_neq* 1.001
vm1_not* 0.990
vm1_rescue* 0.999
vm1_simplereturn* 1.002
vm1_swap* 1.003
vm1_yield* 0.992
vm2_array* 1.002
vm2_bigarray* 0.992
vm2_bighash* 1.163
vm2_case* 1.007
vm2_defined_method* 0.981
vm2_dstr* 0.999
vm2_eval* 0.995
vm2_method* 1.005
vm2_method_missing* 1.007
vm2_method_with_block* 1.006
vm2_mutex* 1.000
vm2_newlambda* 0.998
vm2_poly_method* 1.000
vm2_poly_method_ov* 1.026
vm2_proc* 0.989
vm2_raise1* 1.003
vm2_raise2* 0.996
vm2_regexp* 0.999
vm2_send* 1.013
vm2_super* 1.013
vm2_unif1* 1.012
vm2_zsuper* 1.010
vm3_backtrace 0.996
vm3_clearmethodcache 0.994
vm3_gc 0.996
vm_thread_alive_check1 1.002
vm_thread_close 1.021
vm_thread_create_join 0.985
vm_thread_mutex1 1.007
vm_thread_mutex2 1.007
vm_thread_mutex3 1.006
vm_thread_pass 1.001
vm_thread_pass_flood 0.995
vm_thread_pipe 1.007
vm_thread_queue 1.010
Log file: bmlog-20140922-053859.26000
next prev parent reply other threads:[~2014-09-22 18:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-22 18:41 [PATCH] st.c: use ccan linked-list Eric Wong
2014-09-22 18:46 ` Eric Wong [this message]
2014-09-22 23:18 ` bench results on AMD Phenom II X4 945 Eric Wong
2014-10-02 18:48 ` [PATCH 2/1] st.c: fix up st_foreach* for ccan linked-list Eric Wong
2014-10-03 22:26 ` Eric Wong
2014-10-04 1:43 ` [PATCH 2/1] st.c: simplify st_foreach/st_foreach_check Eric Wong
2014-10-04 6:21 ` st-ll v2 bench results on AMD FX-8320 Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=st-ccan-list-bench@meltdown \
--to=e@80x24.org \
--cc=spew@80x24.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).