summaryrefslogtreecommitdiff
path: root/ruby_2_2/benchmark
diff options
context:
space:
mode:
Diffstat (limited to 'ruby_2_2/benchmark')
-rw-r--r--ruby_2_2/benchmark/bm_app_answer.rb15
-rw-r--r--ruby_2_2/benchmark/bm_app_aobench.rb291
-rw-r--r--ruby_2_2/benchmark/bm_app_erb.rb26
-rw-r--r--ruby_2_2/benchmark/bm_app_factorial.rb11
-rw-r--r--ruby_2_2/benchmark/bm_app_fib.rb10
-rw-r--r--ruby_2_2/benchmark/bm_app_lc_fizzbuzz.rb52
-rw-r--r--ruby_2_2/benchmark/bm_app_mandelbrot.rb23
-rw-r--r--ruby_2_2/benchmark/bm_app_pentomino.rb259
-rw-r--r--ruby_2_2/benchmark/bm_app_raise.rb8
-rw-r--r--ruby_2_2/benchmark/bm_app_strconcat.rb5
-rw-r--r--ruby_2_2/benchmark/bm_app_tak.rb13
-rw-r--r--ruby_2_2/benchmark/bm_app_tarai.rb10
-rw-r--r--ruby_2_2/benchmark/bm_app_uri.rb8
-rw-r--r--ruby_2_2/benchmark/bm_hash_aref_flo.rb4
-rw-r--r--ruby_2_2/benchmark/bm_hash_aref_miss.rb5
-rw-r--r--ruby_2_2/benchmark/bm_hash_aref_str.rb4
-rw-r--r--ruby_2_2/benchmark/bm_hash_aref_sym.rb9
-rw-r--r--ruby_2_2/benchmark/bm_hash_aref_sym_long.rb13
-rw-r--r--ruby_2_2/benchmark/bm_hash_flatten.rb9
-rw-r--r--ruby_2_2/benchmark/bm_hash_ident_flo.rb4
-rw-r--r--ruby_2_2/benchmark/bm_hash_ident_num.rb4
-rw-r--r--ruby_2_2/benchmark/bm_hash_ident_obj.rb4
-rw-r--r--ruby_2_2/benchmark/bm_hash_ident_str.rb4
-rw-r--r--ruby_2_2/benchmark/bm_hash_ident_sym.rb4
-rw-r--r--ruby_2_2/benchmark/bm_hash_keys.rb9
-rw-r--r--ruby_2_2/benchmark/bm_hash_shift.rb10
-rw-r--r--ruby_2_2/benchmark/bm_hash_values.rb9
-rw-r--r--ruby_2_2/benchmark/bm_io_file_create.rb13
-rw-r--r--ruby_2_2/benchmark/bm_io_file_read.rb15
-rw-r--r--ruby_2_2/benchmark/bm_io_file_write.rb14
-rw-r--r--ruby_2_2/benchmark/bm_io_select.rb9
-rw-r--r--ruby_2_2/benchmark/bm_io_select2.rb22
-rw-r--r--ruby_2_2/benchmark/bm_io_select3.rb21
-rw-r--r--ruby_2_2/benchmark/bm_loop_for.rb3
-rw-r--r--ruby_2_2/benchmark/bm_loop_generator.rb14
-rw-r--r--ruby_2_2/benchmark/bm_loop_times.rb1
-rw-r--r--ruby_2_2/benchmark/bm_loop_whileloop.rb4
-rw-r--r--ruby_2_2/benchmark/bm_loop_whileloop2.rb4
-rw-r--r--ruby_2_2/benchmark/bm_marshal_dump_flo.rb2
-rw-r--r--ruby_2_2/benchmark/bm_securerandom.rb5
-rw-r--r--ruby_2_2/benchmark/bm_so_ackermann.rb19
-rw-r--r--ruby_2_2/benchmark/bm_so_array.rb23
-rw-r--r--ruby_2_2/benchmark/bm_so_binary_trees.rb62
-rw-r--r--ruby_2_2/benchmark/bm_so_concatenate.rb18
-rw-r--r--ruby_2_2/benchmark/bm_so_count_words.rb19
-rw-r--r--ruby_2_2/benchmark/bm_so_exception.rb61
-rw-r--r--ruby_2_2/benchmark/bm_so_fannkuch.rb45
-rw-r--r--ruby_2_2/benchmark/bm_so_fasta.rb81
-rw-r--r--ruby_2_2/benchmark/bm_so_k_nucleotide.rb48
-rw-r--r--ruby_2_2/benchmark/bm_so_lists.rb47
-rw-r--r--ruby_2_2/benchmark/bm_so_mandelbrot.rb57
-rw-r--r--ruby_2_2/benchmark/bm_so_matrix.rb48
-rw-r--r--ruby_2_2/benchmark/bm_so_meteor_contest.rb564
-rw-r--r--ruby_2_2/benchmark/bm_so_nbody.rb148
-rw-r--r--ruby_2_2/benchmark/bm_so_nested_loop.rb24
-rw-r--r--ruby_2_2/benchmark/bm_so_nsieve.rb35
-rw-r--r--ruby_2_2/benchmark/bm_so_nsieve_bits.rb43
-rw-r--r--ruby_2_2/benchmark/bm_so_object.rb56
-rw-r--r--ruby_2_2/benchmark/bm_so_partial_sums.rb31
-rw-r--r--ruby_2_2/benchmark/bm_so_pidigits.rb92
-rw-r--r--ruby_2_2/benchmark/bm_so_random.rb20
-rw-r--r--ruby_2_2/benchmark/bm_so_reverse_complement.rb30
-rw-r--r--ruby_2_2/benchmark/bm_so_sieve.rb24
-rw-r--r--ruby_2_2/benchmark/bm_so_spectralnorm.rb50
-rw-r--r--ruby_2_2/benchmark/bm_vm1_attr_ivar.rb14
-rw-r--r--ruby_2_2/benchmark/bm_vm1_attr_ivar_set.rb14
-rw-r--r--ruby_2_2/benchmark/bm_vm1_block.rb10
-rw-r--r--ruby_2_2/benchmark/bm_vm1_const.rb8
-rw-r--r--ruby_2_2/benchmark/bm_vm1_ensure.rb11
-rw-r--r--ruby_2_2/benchmark/bm_vm1_float_simple.rb7
-rw-r--r--ruby_2_2/benchmark/bm_vm1_gc_short_lived.rb10
-rw-r--r--ruby_2_2/benchmark/bm_vm1_gc_short_with_complex_long.rb27
-rw-r--r--ruby_2_2/benchmark/bm_vm1_gc_short_with_long.rb13
-rw-r--r--ruby_2_2/benchmark/bm_vm1_gc_short_with_symbol.rb15
-rw-r--r--ruby_2_2/benchmark/bm_vm1_gc_wb_ary.rb10
-rw-r--r--ruby_2_2/benchmark/bm_vm1_gc_wb_obj.rb13
-rw-r--r--ruby_2_2/benchmark/bm_vm1_ivar.rb8
-rw-r--r--ruby_2_2/benchmark/bm_vm1_ivar_set.rb6
-rw-r--r--ruby_2_2/benchmark/bm_vm1_length.rb9
-rw-r--r--ruby_2_2/benchmark/bm_vm1_lvar_init.rb18
-rw-r--r--ruby_2_2/benchmark/bm_vm1_lvar_set.rb5
-rw-r--r--ruby_2_2/benchmark/bm_vm1_neq.rb8
-rw-r--r--ruby_2_2/benchmark/bm_vm1_not.rb7
-rw-r--r--ruby_2_2/benchmark/bm_vm1_rescue.rb7
-rw-r--r--ruby_2_2/benchmark/bm_vm1_simplereturn.rb9
-rw-r--r--ruby_2_2/benchmark/bm_vm1_swap.rb8
-rw-r--r--ruby_2_2/benchmark/bm_vm1_yield.rb10
-rw-r--r--ruby_2_2/benchmark/bm_vm2_array.rb5
-rw-r--r--ruby_2_2/benchmark/bm_vm2_bigarray.rb106
-rw-r--r--ruby_2_2/benchmark/bm_vm2_bighash.rb5
-rw-r--r--ruby_2_2/benchmark/bm_vm2_case.rb14
-rw-r--r--ruby_2_2/benchmark/bm_vm2_defined_method.rb9
-rw-r--r--ruby_2_2/benchmark/bm_vm2_dstr.rb6
-rw-r--r--ruby_2_2/benchmark/bm_vm2_eval.rb6
-rw-r--r--ruby_2_2/benchmark/bm_vm2_method.rb9
-rw-r--r--ruby_2_2/benchmark/bm_vm2_method_missing.rb12
-rw-r--r--ruby_2_2/benchmark/bm_vm2_method_with_block.rb9
-rw-r--r--ruby_2_2/benchmark/bm_vm2_mutex.rb9
-rw-r--r--ruby_2_2/benchmark/bm_vm2_newlambda.rb5
-rw-r--r--ruby_2_2/benchmark/bm_vm2_poly_method.rb20
-rw-r--r--ruby_2_2/benchmark/bm_vm2_poly_method_ov.rb20
-rw-r--r--ruby_2_2/benchmark/bm_vm2_proc.rb14
-rw-r--r--ruby_2_2/benchmark/bm_vm2_raise1.rb18
-rw-r--r--ruby_2_2/benchmark/bm_vm2_raise2.rb18
-rw-r--r--ruby_2_2/benchmark/bm_vm2_regexp.rb6
-rw-r--r--ruby_2_2/benchmark/bm_vm2_send.rb12
-rw-r--r--ruby_2_2/benchmark/bm_vm2_struct_big_aref_hi.rb7
-rw-r--r--ruby_2_2/benchmark/bm_vm2_struct_big_aref_lo.rb7
-rw-r--r--ruby_2_2/benchmark/bm_vm2_struct_big_aset.rb7
-rw-r--r--ruby_2_2/benchmark/bm_vm2_struct_small_aref.rb7
-rw-r--r--ruby_2_2/benchmark/bm_vm2_struct_small_aset.rb7
-rw-r--r--ruby_2_2/benchmark/bm_vm2_super.rb20
-rw-r--r--ruby_2_2/benchmark/bm_vm2_unif1.rb8
-rw-r--r--ruby_2_2/benchmark/bm_vm2_zsuper.rb20
-rw-r--r--ruby_2_2/benchmark/bm_vm3_backtrace.rb22
-rw-r--r--ruby_2_2/benchmark/bm_vm3_clearmethodcache.rb8
-rwxr-xr-xruby_2_2/benchmark/bm_vm3_gc.rb7
-rw-r--r--ruby_2_2/benchmark/bm_vm_thread_alive_check1.rb6
-rw-r--r--ruby_2_2/benchmark/bm_vm_thread_close.rb6
-rw-r--r--ruby_2_2/benchmark/bm_vm_thread_create_join.rb6
-rw-r--r--ruby_2_2/benchmark/bm_vm_thread_mutex1.rb21
-rw-r--r--ruby_2_2/benchmark/bm_vm_thread_mutex2.rb21
-rw-r--r--ruby_2_2/benchmark/bm_vm_thread_mutex3.rb20
-rw-r--r--ruby_2_2/benchmark/bm_vm_thread_pass.rb15
-rw-r--r--ruby_2_2/benchmark/bm_vm_thread_pass_flood.rb8
-rw-r--r--ruby_2_2/benchmark/bm_vm_thread_pipe.rb17
-rw-r--r--ruby_2_2/benchmark/bm_vm_thread_queue.rb18
-rw-r--r--ruby_2_2/benchmark/driver.rb321
-rw-r--r--ruby_2_2/benchmark/gc/aobench.rb1
-rw-r--r--ruby_2_2/benchmark/gc/binary_trees.rb1
-rw-r--r--ruby_2_2/benchmark/gc/gcbench.rb56
-rw-r--r--ruby_2_2/benchmark/gc/hash1.rb11
-rw-r--r--ruby_2_2/benchmark/gc/hash2.rb7
-rw-r--r--ruby_2_2/benchmark/gc/null.rb1
-rw-r--r--ruby_2_2/benchmark/gc/pentomino.rb1
-rw-r--r--ruby_2_2/benchmark/gc/rdoc.rb13
-rw-r--r--ruby_2_2/benchmark/gc/redblack.rb366
-rw-r--r--ruby_2_2/benchmark/gc/ring.rb29
-rw-r--r--ruby_2_2/benchmark/make_fasta_output.rb19
-rw-r--r--ruby_2_2/benchmark/other-lang/ack.pl11
-rw-r--r--ruby_2_2/benchmark/other-lang/ack.py16
-rw-r--r--ruby_2_2/benchmark/other-lang/ack.rb12
-rw-r--r--ruby_2_2/benchmark/other-lang/ack.scm7
-rw-r--r--ruby_2_2/benchmark/other-lang/eval.rb66
-rw-r--r--ruby_2_2/benchmark/other-lang/fact.pl13
-rw-r--r--ruby_2_2/benchmark/other-lang/fact.py18
-rw-r--r--ruby_2_2/benchmark/other-lang/fact.rb13
-rw-r--r--ruby_2_2/benchmark/other-lang/fact.scm8
-rw-r--r--ruby_2_2/benchmark/other-lang/fib.pl11
-rw-r--r--ruby_2_2/benchmark/other-lang/fib.py7
-rw-r--r--ruby_2_2/benchmark/other-lang/fib.rb9
-rw-r--r--ruby_2_2/benchmark/other-lang/fib.scm7
-rw-r--r--ruby_2_2/benchmark/other-lang/loop.pl3
-rw-r--r--ruby_2_2/benchmark/other-lang/loop.py2
-rw-r--r--ruby_2_2/benchmark/other-lang/loop.rb4
-rw-r--r--ruby_2_2/benchmark/other-lang/loop.scm1
-rw-r--r--ruby_2_2/benchmark/other-lang/loop2.rb1
-rw-r--r--ruby_2_2/benchmark/other-lang/tak.pl11
-rw-r--r--ruby_2_2/benchmark/other-lang/tak.py8
-rw-r--r--ruby_2_2/benchmark/other-lang/tak.rb13
-rw-r--r--ruby_2_2/benchmark/other-lang/tak.scm10
-rw-r--r--ruby_2_2/benchmark/prepare_so_count_words.rb15
-rw-r--r--ruby_2_2/benchmark/prepare_so_k_nucleotide.rb2
-rw-r--r--ruby_2_2/benchmark/prepare_so_reverse_complement.rb2
-rw-r--r--ruby_2_2/benchmark/report.rb79
-rw-r--r--ruby_2_2/benchmark/run.rb127
-rw-r--r--ruby_2_2/benchmark/runc.rb27
-rw-r--r--ruby_2_2/benchmark/wc.input.base25
168 files changed, 0 insertions, 4757 deletions
diff --git a/ruby_2_2/benchmark/bm_app_answer.rb b/ruby_2_2/benchmark/bm_app_answer.rb
deleted file mode 100644
index 3cd8a8fd37..0000000000
--- a/ruby_2_2/benchmark/bm_app_answer.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_app_aobench.rb b/ruby_2_2/benchmark/bm_app_aobench.rb
deleted file mode 100644
index ffab116fcd..0000000000
--- a/ruby_2_2/benchmark/bm_app_aobench.rb
+++ /dev/null
@@ -1,291 +0,0 @@
-# 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
diff --git a/ruby_2_2/benchmark/bm_app_erb.rb b/ruby_2_2/benchmark/bm_app_erb.rb
deleted file mode 100644
index 77c66a7949..0000000000
--- a/ruby_2_2/benchmark/bm_app_erb.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# 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>
diff --git a/ruby_2_2/benchmark/bm_app_factorial.rb b/ruby_2_2/benchmark/bm_app_factorial.rb
deleted file mode 100644
index 45f471dfdb..0000000000
--- a/ruby_2_2/benchmark/bm_app_factorial.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-def fact(n)
- if(n > 1)
- n * fact(n-1)
- else
- 1
- end
-end
-
-100.times {
- fact(5000)
-}
diff --git a/ruby_2_2/benchmark/bm_app_fib.rb b/ruby_2_2/benchmark/bm_app_fib.rb
deleted file mode 100644
index 34a7b2e725..0000000000
--- a/ruby_2_2/benchmark/bm_app_fib.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-def fib n
- if n < 3
- 1
- else
- fib(n-1) + fib(n-2)
- end
-end
-
-fib(34)
-
diff --git a/ruby_2_2/benchmark/bm_app_lc_fizzbuzz.rb b/ruby_2_2/benchmark/bm_app_lc_fizzbuzz.rb
deleted file mode 100644
index f09574bbeb..0000000000
--- a/ruby_2_2/benchmark/bm_app_lc_fizzbuzz.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# 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
diff --git a/ruby_2_2/benchmark/bm_app_mandelbrot.rb b/ruby_2_2/benchmark/bm_app_mandelbrot.rb
deleted file mode 100644
index 801b75e8e2..0000000000
--- a/ruby_2_2/benchmark/bm_app_mandelbrot.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-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)
- }
-}
-
diff --git a/ruby_2_2/benchmark/bm_app_pentomino.rb b/ruby_2_2/benchmark/bm_app_pentomino.rb
deleted file mode 100644
index 59c63f358e..0000000000
--- a/ruby_2_2/benchmark/bm_app_pentomino.rb
+++ /dev/null
@@ -1,259 +0,0 @@
-#!/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)
diff --git a/ruby_2_2/benchmark/bm_app_raise.rb b/ruby_2_2/benchmark/bm_app_raise.rb
deleted file mode 100644
index 5db8f95d50..0000000000
--- a/ruby_2_2/benchmark/bm_app_raise.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-i = 0
-while i<300000
- i += 1
- begin
- raise
- rescue
- end
-end
diff --git a/ruby_2_2/benchmark/bm_app_strconcat.rb b/ruby_2_2/benchmark/bm_app_strconcat.rb
deleted file mode 100644
index 7eed7c1aed..0000000000
--- a/ruby_2_2/benchmark/bm_app_strconcat.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-i = 0
-while i<2_000_000
- "#{1+1} #{1+1} #{1+1}"
- i += 1
-end
diff --git a/ruby_2_2/benchmark/bm_app_tak.rb b/ruby_2_2/benchmark/bm_app_tak.rb
deleted file mode 100644
index efe5380f4e..0000000000
--- a/ruby_2_2/benchmark/bm_app_tak.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-
-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)
-
diff --git a/ruby_2_2/benchmark/bm_app_tarai.rb b/ruby_2_2/benchmark/bm_app_tarai.rb
deleted file mode 100644
index 4c146f5ccf..0000000000
--- a/ruby_2_2/benchmark/bm_app_tarai.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-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)
diff --git a/ruby_2_2/benchmark/bm_app_uri.rb b/ruby_2_2/benchmark/bm_app_uri.rb
deleted file mode 100644
index 586edfd5dc..0000000000
--- a/ruby_2_2/benchmark/bm_app_uri.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'uri'
-
-100_000.times{
- uri = URI.parse('http://www.ruby-lang.org')
- uri.scheme
- uri.host
- uri.port
-}
diff --git a/ruby_2_2/benchmark/bm_hash_aref_flo.rb b/ruby_2_2/benchmark/bm_hash_aref_flo.rb
deleted file mode 100644
index 2217274c82..0000000000
--- a/ruby_2_2/benchmark/bm_hash_aref_flo.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}
-strs = [*1..10000].map! {|i| i.fdiv(10)}
-strs.each { |s| h[s] = s }
-50.times { strs.each { |s| h[s] } }
diff --git a/ruby_2_2/benchmark/bm_hash_aref_miss.rb b/ruby_2_2/benchmark/bm_hash_aref_miss.rb
deleted file mode 100644
index b0913dd4bb..0000000000
--- a/ruby_2_2/benchmark/bm_hash_aref_miss.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-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] } }
diff --git a/ruby_2_2/benchmark/bm_hash_aref_str.rb b/ruby_2_2/benchmark/bm_hash_aref_str.rb
deleted file mode 100644
index 19439b061b..0000000000
--- a/ruby_2_2/benchmark/bm_hash_aref_str.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}
-strs = ('a'..'z').to_a.map!(&:freeze)
-strs.each { |s| h[s] = s }
-200_000.times { strs.each { |s| h[s] } }
diff --git a/ruby_2_2/benchmark/bm_hash_aref_sym.rb b/ruby_2_2/benchmark/bm_hash_aref_sym.rb
deleted file mode 100644
index f75d163fe6..0000000000
--- a/ruby_2_2/benchmark/bm_hash_aref_sym.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-h = {}
-syms = ('a'..'z').to_a
-begin
- syms = eval("%i[#{syms.join(' ')}]")
-rescue SyntaxError # <= 1.9.3
- syms.map!(&:to_sym)
-end
-syms.each { |s| h[s] = s }
-200_000.times { syms.each { |s| h[s] } }
diff --git a/ruby_2_2/benchmark/bm_hash_aref_sym_long.rb b/ruby_2_2/benchmark/bm_hash_aref_sym_long.rb
deleted file mode 100644
index 9dab8df7be..0000000000
--- a/ruby_2_2/benchmark/bm_hash_aref_sym_long.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-h = {}
-syms = %w[puts warn syswrite write stat bacon lettuce tomato
-some symbols in this array may already be interned others should not be
-hash browns make good breakfast but not cooked using prime numbers
-shift for division entries delete_if keys exist?
-]
-begin
- syms = eval("%i[#{syms.join(' ')}]")
-rescue SyntaxError # <= 1.9.3
- syms.map!(&:to_sym)
-end
-syms.each { |s| h[s] = s }
-200_000.times { syms.each { |s| h[s] } }
diff --git a/ruby_2_2/benchmark/bm_hash_flatten.rb b/ruby_2_2/benchmark/bm_hash_flatten.rb
deleted file mode 100644
index e944aae9f2..0000000000
--- a/ruby_2_2/benchmark/bm_hash_flatten.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-h = {}
-
-10000.times do |i|
- h[i] = nil
-end
-
-1000.times do
- h.flatten
-end
diff --git a/ruby_2_2/benchmark/bm_hash_ident_flo.rb b/ruby_2_2/benchmark/bm_hash_ident_flo.rb
deleted file mode 100644
index 0c7edfed3e..0000000000
--- a/ruby_2_2/benchmark/bm_hash_ident_flo.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}.compare_by_identity
-strs = (1..10000).to_a.map!(&:to_f)
-strs.each { |s| h[s] = s }
-50.times { strs.each { |s| h[s] } }
diff --git a/ruby_2_2/benchmark/bm_hash_ident_num.rb b/ruby_2_2/benchmark/bm_hash_ident_num.rb
deleted file mode 100644
index b226736c6f..0000000000
--- a/ruby_2_2/benchmark/bm_hash_ident_num.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}.compare_by_identity
-nums = (1..26).to_a
-nums.each { |n| h[n] = n }
-200_000.times { nums.each { |n| h[n] } }
diff --git a/ruby_2_2/benchmark/bm_hash_ident_obj.rb b/ruby_2_2/benchmark/bm_hash_ident_obj.rb
deleted file mode 100644
index 4b3b58edec..0000000000
--- a/ruby_2_2/benchmark/bm_hash_ident_obj.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}.compare_by_identity
-objs = 26.times.map { Object.new }
-objs.each { |o| h[o] = o }
-200_000.times { objs.each { |o| h[o] } }
diff --git a/ruby_2_2/benchmark/bm_hash_ident_str.rb b/ruby_2_2/benchmark/bm_hash_ident_str.rb
deleted file mode 100644
index 8582b38e31..0000000000
--- a/ruby_2_2/benchmark/bm_hash_ident_str.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-h = {}.compare_by_identity
-strs = ('a'..'z').to_a
-strs.each { |s| h[s] = s }
-200_000.times { strs.each { |s| h[s] } }
diff --git a/ruby_2_2/benchmark/bm_hash_ident_sym.rb b/ruby_2_2/benchmark/bm_hash_ident_sym.rb
deleted file mode 100644
index 4c81e3d28e..0000000000
--- a/ruby_2_2/benchmark/bm_hash_ident_sym.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-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] } }
diff --git a/ruby_2_2/benchmark/bm_hash_keys.rb b/ruby_2_2/benchmark/bm_hash_keys.rb
deleted file mode 100644
index 6863cd01f9..0000000000
--- a/ruby_2_2/benchmark/bm_hash_keys.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-h = {}
-
-10000.times do |i|
- h[i] = nil
-end
-
-5000.times do
- h.keys
-end
diff --git a/ruby_2_2/benchmark/bm_hash_shift.rb b/ruby_2_2/benchmark/bm_hash_shift.rb
deleted file mode 100644
index a645671a5b..0000000000
--- a/ruby_2_2/benchmark/bm_hash_shift.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-h = {}
-
-10000.times do |i|
- h[i] = nil
-end
-
-50000.times do
- k, v = h.shift
- h[k] = v
-end
diff --git a/ruby_2_2/benchmark/bm_hash_values.rb b/ruby_2_2/benchmark/bm_hash_values.rb
deleted file mode 100644
index 069441302f..0000000000
--- a/ruby_2_2/benchmark/bm_hash_values.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-h = {}
-
-10000.times do |i|
- h[i] = nil
-end
-
-5000.times do
- h.values
-end
diff --git a/ruby_2_2/benchmark/bm_io_file_create.rb b/ruby_2_2/benchmark/bm_io_file_create.rb
deleted file mode 100644
index 2f205c1333..0000000000
--- a/ruby_2_2/benchmark/bm_io_file_create.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Create files
-#
-
-max = 200_000
-file = './tmpfile_of_bm_io_file_create'
-
-max.times{
- f = open(file, 'w')
- f.close#(true)
-}
-File.unlink(file)
-
diff --git a/ruby_2_2/benchmark/bm_io_file_read.rb b/ruby_2_2/benchmark/bm_io_file_read.rb
deleted file mode 100644
index b9e796ed30..0000000000
--- a/ruby_2_2/benchmark/bm_io_file_read.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# 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
-}
diff --git a/ruby_2_2/benchmark/bm_io_file_write.rb b/ruby_2_2/benchmark/bm_io_file_write.rb
deleted file mode 100644
index aa1be0e5fe..0000000000
--- a/ruby_2_2/benchmark/bm_io_file_write.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# 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
-}
diff --git a/ruby_2_2/benchmark/bm_io_select.rb b/ruby_2_2/benchmark/bm_io_select.rb
deleted file mode 100644
index 19248daeb1..0000000000
--- a/ruby_2_2/benchmark/bm_io_select.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# IO.select performance
-
-w = [ IO.pipe[1] ];
-
-nr = 1000000
-nr.times {
- IO.select nil, w
-}
-
diff --git a/ruby_2_2/benchmark/bm_io_select2.rb b/ruby_2_2/benchmark/bm_io_select2.rb
deleted file mode 100644
index 10e37d71b2..0000000000
--- a/ruby_2_2/benchmark/bm_io_select2.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# 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
-
diff --git a/ruby_2_2/benchmark/bm_io_select3.rb b/ruby_2_2/benchmark/bm_io_select3.rb
deleted file mode 100644
index 7d0ba1f092..0000000000
--- a/ruby_2_2/benchmark/bm_io_select3.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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
-
diff --git a/ruby_2_2/benchmark/bm_loop_for.rb b/ruby_2_2/benchmark/bm_loop_for.rb
deleted file mode 100644
index 0fc4cc1511..0000000000
--- a/ruby_2_2/benchmark/bm_loop_for.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-for i in 1..30_000_000
- #
-end
diff --git a/ruby_2_2/benchmark/bm_loop_generator.rb b/ruby_2_2/benchmark/bm_loop_generator.rb
deleted file mode 100644
index d3375c744c..0000000000
--- a/ruby_2_2/benchmark/bm_loop_generator.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_loop_times.rb b/ruby_2_2/benchmark/bm_loop_times.rb
deleted file mode 100644
index 521f72ad1a..0000000000
--- a/ruby_2_2/benchmark/bm_loop_times.rb
+++ /dev/null
@@ -1 +0,0 @@
-30_000_000.times{|e|}
diff --git a/ruby_2_2/benchmark/bm_loop_whileloop.rb b/ruby_2_2/benchmark/bm_loop_whileloop.rb
deleted file mode 100644
index 0072822c06..0000000000
--- a/ruby_2_2/benchmark/bm_loop_whileloop.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-i = 0
-while i<30_000_000 # benchmark loop 1
- i += 1
-end
diff --git a/ruby_2_2/benchmark/bm_loop_whileloop2.rb b/ruby_2_2/benchmark/bm_loop_whileloop2.rb
deleted file mode 100644
index 47d02dffc4..0000000000
--- a/ruby_2_2/benchmark/bm_loop_whileloop2.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-i = 0
-while i< 6_000_000 # benchmark loop 2
- i += 1
-end
diff --git a/ruby_2_2/benchmark/bm_marshal_dump_flo.rb b/ruby_2_2/benchmark/bm_marshal_dump_flo.rb
deleted file mode 100644
index 9b8d0c6afb..0000000000
--- a/ruby_2_2/benchmark/bm_marshal_dump_flo.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-bug10761 = 10000.times.map { |x| x.to_f }
-100.times { Marshal.dump(bug10761) }
diff --git a/ruby_2_2/benchmark/bm_securerandom.rb b/ruby_2_2/benchmark/bm_securerandom.rb
deleted file mode 100644
index a082ea6d5b..0000000000
--- a/ruby_2_2/benchmark/bm_securerandom.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require "securerandom"
-
-20_0000.times do
- SecureRandom.random_number(100)
-end
diff --git a/ruby_2_2/benchmark/bm_so_ackermann.rb b/ruby_2_2/benchmark/bm_so_ackermann.rb
deleted file mode 100644
index 7db5be9050..0000000000
--- a/ruby_2_2/benchmark/bm_so_ackermann.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/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)
-
-
diff --git a/ruby_2_2/benchmark/bm_so_array.rb b/ruby_2_2/benchmark/bm_so_array.rb
deleted file mode 100644
index 2b8fce8f99..0000000000
--- a/ruby_2_2/benchmark/bm_so_array.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/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}"
-
-
diff --git a/ruby_2_2/benchmark/bm_so_binary_trees.rb b/ruby_2_2/benchmark/bm_so_binary_trees.rb
deleted file mode 100644
index b1693e4109..0000000000
--- a/ruby_2_2/benchmark/bm_so_binary_trees.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-# 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
diff --git a/ruby_2_2/benchmark/bm_so_concatenate.rb b/ruby_2_2/benchmark/bm_so_concatenate.rb
deleted file mode 100644
index 873214de7c..0000000000
--- a/ruby_2_2/benchmark/bm_so_concatenate.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/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
-
-
diff --git a/ruby_2_2/benchmark/bm_so_count_words.rb b/ruby_2_2/benchmark/bm_so_count_words.rb
deleted file mode 100644
index 65f6337a4a..0000000000
--- a/ruby_2_2/benchmark/bm_so_count_words.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/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}"
-
diff --git a/ruby_2_2/benchmark/bm_so_exception.rb b/ruby_2_2/benchmark/bm_so_exception.rb
deleted file mode 100644
index deb003a594..0000000000
--- a/ruby_2_2/benchmark/bm_so_exception.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/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
diff --git a/ruby_2_2/benchmark/bm_so_fannkuch.rb b/ruby_2_2/benchmark/bm_so_fannkuch.rb
deleted file mode 100644
index bac5ecd44c..0000000000
--- a/ruby_2_2/benchmark/bm_so_fannkuch.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# 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)}"
-
diff --git a/ruby_2_2/benchmark/bm_so_fasta.rb b/ruby_2_2/benchmark/bm_so_fasta.rb
deleted file mode 100644
index 3f759ba7ae..0000000000
--- a/ruby_2_2/benchmark/bm_so_fasta.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-# 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)
-
diff --git a/ruby_2_2/benchmark/bm_so_k_nucleotide.rb b/ruby_2_2/benchmark/bm_so_k_nucleotide.rb
deleted file mode 100644
index dadab3e79c..0000000000
--- a/ruby_2_2/benchmark/bm_so_k_nucleotide.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-# 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) }
-
diff --git a/ruby_2_2/benchmark/bm_so_lists.rb b/ruby_2_2/benchmark/bm_so_lists.rb
deleted file mode 100644
index e8f4a2a5f7..0000000000
--- a/ruby_2_2/benchmark/bm_so_lists.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-#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
diff --git a/ruby_2_2/benchmark/bm_so_mandelbrot.rb b/ruby_2_2/benchmark/bm_so_mandelbrot.rb
deleted file mode 100644
index 76331c64b8..0000000000
--- a/ruby_2_2/benchmark/bm_so_mandelbrot.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-# 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
diff --git a/ruby_2_2/benchmark/bm_so_matrix.rb b/ruby_2_2/benchmark/bm_so_matrix.rb
deleted file mode 100644
index e2c5c8e559..0000000000
--- a/ruby_2_2/benchmark/bm_so_matrix.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/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]}"
-
-
diff --git a/ruby_2_2/benchmark/bm_so_meteor_contest.rb b/ruby_2_2/benchmark/bm_so_meteor_contest.rb
deleted file mode 100644
index b8e93bd150..0000000000
--- a/ruby_2_2/benchmark/bm_so_meteor_contest.rb
+++ /dev/null
@@ -1,564 +0,0 @@
-#!/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!!!
-
diff --git a/ruby_2_2/benchmark/bm_so_nbody.rb b/ruby_2_2/benchmark/bm_so_nbody.rb
deleted file mode 100644
index d6c5bb9e61..0000000000
--- a/ruby_2_2/benchmark/bm_so_nbody.rb
+++ /dev/null
@@ -1,148 +0,0 @@
-# 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)
diff --git a/ruby_2_2/benchmark/bm_so_nested_loop.rb b/ruby_2_2/benchmark/bm_so_nested_loop.rb
deleted file mode 100644
index a0513f8c47..0000000000
--- a/ruby_2_2/benchmark/bm_so_nested_loop.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/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
-
-
diff --git a/ruby_2_2/benchmark/bm_so_nsieve.rb b/ruby_2_2/benchmark/bm_so_nsieve.rb
deleted file mode 100644
index a65cc78233..0000000000
--- a/ruby_2_2/benchmark/bm_so_nsieve.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# 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
diff --git a/ruby_2_2/benchmark/bm_so_nsieve_bits.rb b/ruby_2_2/benchmark/bm_so_nsieve_bits.rb
deleted file mode 100644
index 6f958ee44e..0000000000
--- a/ruby_2_2/benchmark/bm_so_nsieve_bits.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/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
-
diff --git a/ruby_2_2/benchmark/bm_so_object.rb b/ruby_2_2/benchmark/bm_so_object.rb
deleted file mode 100644
index e8607c7199..0000000000
--- a/ruby_2_2/benchmark/bm_so_object.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/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
-
diff --git a/ruby_2_2/benchmark/bm_so_partial_sums.rb b/ruby_2_2/benchmark/bm_so_partial_sums.rb
deleted file mode 100644
index 630b45cb8d..0000000000
--- a/ruby_2_2/benchmark/bm_so_partial_sums.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_so_pidigits.rb b/ruby_2_2/benchmark/bm_so_pidigits.rb
deleted file mode 100644
index c7d6fbfb4d..0000000000
--- a/ruby_2_2/benchmark/bm_so_pidigits.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-# 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
-
diff --git a/ruby_2_2/benchmark/bm_so_random.rb b/ruby_2_2/benchmark/bm_so_random.rb
deleted file mode 100644
index a66b9e8e63..0000000000
--- a/ruby_2_2/benchmark/bm_so_random.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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)
diff --git a/ruby_2_2/benchmark/bm_so_reverse_complement.rb b/ruby_2_2/benchmark/bm_so_reverse_complement.rb
deleted file mode 100644
index 82ea666994..0000000000
--- a/ruby_2_2/benchmark/bm_so_reverse_complement.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/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)
diff --git a/ruby_2_2/benchmark/bm_so_sieve.rb b/ruby_2_2/benchmark/bm_so_sieve.rb
deleted file mode 100644
index 43dc302648..0000000000
--- a/ruby_2_2/benchmark/bm_so_sieve.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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
diff --git a/ruby_2_2/benchmark/bm_so_spectralnorm.rb b/ruby_2_2/benchmark/bm_so_spectralnorm.rb
deleted file mode 100644
index 6b97206689..0000000000
--- a/ruby_2_2/benchmark/bm_so_spectralnorm.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-# 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
diff --git a/ruby_2_2/benchmark/bm_vm1_attr_ivar.rb b/ruby_2_2/benchmark/bm_vm1_attr_ivar.rb
deleted file mode 100644
index 16906f3605..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_attr_ivar.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm1_attr_ivar_set.rb b/ruby_2_2/benchmark/bm_vm1_attr_ivar_set.rb
deleted file mode 100644
index 7e7a6b48c0..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_attr_ivar_set.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm1_block.rb b/ruby_2_2/benchmark/bm_vm1_block.rb
deleted file mode 100644
index a9f56b15ea..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_block.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-def m
- yield
-end
-
-i = 0
-while i<30_000_000 # while loop 1
- i += 1
- m{
- }
-end
diff --git a/ruby_2_2/benchmark/bm_vm1_const.rb b/ruby_2_2/benchmark/bm_vm1_const.rb
deleted file mode 100644
index ac59ebccf1..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_const.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-Const = 1
-
-i = 0
-while i<30_000_000 # while loop 1
- i += 1
- j = Const
- k = Const
-end
diff --git a/ruby_2_2/benchmark/bm_vm1_ensure.rb b/ruby_2_2/benchmark/bm_vm1_ensure.rb
deleted file mode 100644
index a1596145f2..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_ensure.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-i = 0
-while i<30_000_000 # benchmark loop 1
- i += 1
- begin
- begin
- ensure
- end
- ensure
- end
-end
-
diff --git a/ruby_2_2/benchmark/bm_vm1_float_simple.rb b/ruby_2_2/benchmark/bm_vm1_float_simple.rb
deleted file mode 100644
index d4581439ff..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_float_simple.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm1_gc_short_lived.rb b/ruby_2_2/benchmark/bm_vm1_gc_short_lived.rb
deleted file mode 100644
index e78bca5668..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_gc_short_lived.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-i = 0
-while i<30_000_000 # while loop 1
- a = '' # short-lived String
- b = ''
- c = ''
- d = ''
- e = ''
- f = ''
- i+=1
-end
diff --git a/ruby_2_2/benchmark/bm_vm1_gc_short_with_complex_long.rb b/ruby_2_2/benchmark/bm_vm1_gc_short_with_complex_long.rb
deleted file mode 100644
index b66052dee0..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_gc_short_with_complex_long.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-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
-
diff --git a/ruby_2_2/benchmark/bm_vm1_gc_short_with_long.rb b/ruby_2_2/benchmark/bm_vm1_gc_short_with_long.rb
deleted file mode 100644
index 298dbc845b..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_gc_short_with_long.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm1_gc_short_with_symbol.rb b/ruby_2_2/benchmark/bm_vm1_gc_short_with_symbol.rb
deleted file mode 100644
index 6b15c1b7bf..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_gc_short_with_symbol.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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
diff --git a/ruby_2_2/benchmark/bm_vm1_gc_wb_ary.rb b/ruby_2_2/benchmark/bm_vm1_gc_wb_ary.rb
deleted file mode 100644
index ecfab51dbf..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_gc_wb_ary.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm1_gc_wb_obj.rb b/ruby_2_2/benchmark/bm_vm1_gc_wb_obj.rb
deleted file mode 100644
index 017eff4f94..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_gc_wb_obj.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm1_ivar.rb b/ruby_2_2/benchmark/bm_vm1_ivar.rb
deleted file mode 100644
index 68a73cf92f..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_ivar.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-@a = 1
-
-i = 0
-while i<30_000_000 # while loop 1
- i += 1
- j = @a
- k = @a
-end
diff --git a/ruby_2_2/benchmark/bm_vm1_ivar_set.rb b/ruby_2_2/benchmark/bm_vm1_ivar_set.rb
deleted file mode 100644
index bd81b06c34..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_ivar_set.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-i = 0
-while i<30_000_000 # while loop 1
- i += 1
- @a = 1
- @b = 2
-end
diff --git a/ruby_2_2/benchmark/bm_vm1_length.rb b/ruby_2_2/benchmark/bm_vm1_length.rb
deleted file mode 100644
index 353de3ab0e..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_length.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-a = 'abc'
-b = [1, 2, 3]
-i = 0
-while i<30_000_000 # while loop 1
- i += 1
- a.length
- b.length
-end
-
diff --git a/ruby_2_2/benchmark/bm_vm1_lvar_init.rb b/ruby_2_2/benchmark/bm_vm1_lvar_init.rb
deleted file mode 100644
index 36f2068811..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_lvar_init.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-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
-
diff --git a/ruby_2_2/benchmark/bm_vm1_lvar_set.rb b/ruby_2_2/benchmark/bm_vm1_lvar_set.rb
deleted file mode 100644
index 222e864134..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_lvar_set.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm1_neq.rb b/ruby_2_2/benchmark/bm_vm1_neq.rb
deleted file mode 100644
index bbb4ae07a4..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_neq.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-i = 0
-obj1 = Object.new
-obj2 = Object.new
-
-while i<30_000_000 # while loop 1
- i += 1
- obj1 != obj2
-end
diff --git a/ruby_2_2/benchmark/bm_vm1_not.rb b/ruby_2_2/benchmark/bm_vm1_not.rb
deleted file mode 100644
index b09ecdcc21..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_not.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-i = 0
-obj = Object.new
-
-while i<30_000_000 # while loop 1
- i += 1
- !obj
-end
diff --git a/ruby_2_2/benchmark/bm_vm1_rescue.rb b/ruby_2_2/benchmark/bm_vm1_rescue.rb
deleted file mode 100644
index b0d3e2bdfa..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_rescue.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-i = 0
-while i<30_000_000 # while loop 1
- i += 1
- begin
- rescue
- end
-end
diff --git a/ruby_2_2/benchmark/bm_vm1_simplereturn.rb b/ruby_2_2/benchmark/bm_vm1_simplereturn.rb
deleted file mode 100644
index 63f9f21675..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_simplereturn.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-def m
- return 1
-end
-i = 0
-while i<30_000_000 # while loop 1
- i += 1
- m
-end
-
diff --git a/ruby_2_2/benchmark/bm_vm1_swap.rb b/ruby_2_2/benchmark/bm_vm1_swap.rb
deleted file mode 100644
index 918f8b2112..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_swap.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-a = 1
-b = 2
-i = 0
-while i<30_000_000 # while loop 1
- i += 1
- a, b = b, a
-end
-
diff --git a/ruby_2_2/benchmark/bm_vm1_yield.rb b/ruby_2_2/benchmark/bm_vm1_yield.rb
deleted file mode 100644
index 775597cea6..0000000000
--- a/ruby_2_2/benchmark/bm_vm1_yield.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-def m
- i = 0
- while i<30_000_000 # while loop 1
- i += 1
- yield
- end
-end
-
-m{}
-
diff --git a/ruby_2_2/benchmark/bm_vm2_array.rb b/ruby_2_2/benchmark/bm_vm2_array.rb
deleted file mode 100644
index df9037c83c..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_array.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- a = [1,2,3,4,5,6,7,8,9,10]
-end
diff --git a/ruby_2_2/benchmark/bm_vm2_bigarray.rb b/ruby_2_2/benchmark/bm_vm2_bigarray.rb
deleted file mode 100644
index b02509d6a2..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_bigarray.rb
+++ /dev/null
@@ -1,106 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_bighash.rb b/ruby_2_2/benchmark/bm_vm2_bighash.rb
deleted file mode 100644
index 5e3f437bb8..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_bighash.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_case.rb b/ruby_2_2/benchmark/bm_vm2_case.rb
deleted file mode 100644
index adc6e4df0a..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_case.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-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
-
diff --git a/ruby_2_2/benchmark/bm_vm2_defined_method.rb b/ruby_2_2/benchmark/bm_vm2_defined_method.rb
deleted file mode 100644
index 053ed6c912..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_defined_method.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_dstr.rb b/ruby_2_2/benchmark/bm_vm2_dstr.rb
deleted file mode 100644
index 58c0f7bbc3..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_dstr.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-i = 0
-x = y = 'z'
-while i<6_000_000 # benchmark loop 2
- i += 1
- str = "foo#{x}bar#{y}baz"
-end
diff --git a/ruby_2_2/benchmark/bm_vm2_eval.rb b/ruby_2_2/benchmark/bm_vm2_eval.rb
deleted file mode 100644
index 307cfc28ef..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_eval.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- eval("1")
-end
-
diff --git a/ruby_2_2/benchmark/bm_vm2_method.rb b/ruby_2_2/benchmark/bm_vm2_method.rb
deleted file mode 100644
index a8ccff7138..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_method.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_method_missing.rb b/ruby_2_2/benchmark/bm_vm2_method_missing.rb
deleted file mode 100644
index 2badc73101..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_method_missing.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_method_with_block.rb b/ruby_2_2/benchmark/bm_vm2_method_with_block.rb
deleted file mode 100644
index b4efb4f520..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_method_with_block.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_mutex.rb b/ruby_2_2/benchmark/bm_vm2_mutex.rb
deleted file mode 100644
index 7362f738c5..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_mutex.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require 'thread'
-
-m = Mutex.new
-
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- m.synchronize{}
-end
diff --git a/ruby_2_2/benchmark/bm_vm2_newlambda.rb b/ruby_2_2/benchmark/bm_vm2_newlambda.rb
deleted file mode 100644
index 6422c9b0d0..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_newlambda.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- lambda {}
-end
diff --git a/ruby_2_2/benchmark/bm_vm2_poly_method.rb b/ruby_2_2/benchmark/bm_vm2_poly_method.rb
deleted file mode 100644
index c82c0e4bce..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_poly_method.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_poly_method_ov.rb b/ruby_2_2/benchmark/bm_vm2_poly_method_ov.rb
deleted file mode 100644
index aa5fd1dd38..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_poly_method_ov.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_proc.rb b/ruby_2_2/benchmark/bm_vm2_proc.rb
deleted file mode 100644
index 65e5217371..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_proc.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-def m &b
- b
-end
-
-pr = m{
- a = 1
-}
-
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- pr.call
-end
-
diff --git a/ruby_2_2/benchmark/bm_vm2_raise1.rb b/ruby_2_2/benchmark/bm_vm2_raise1.rb
deleted file mode 100644
index aa5387987f..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_raise1.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_raise2.rb b/ruby_2_2/benchmark/bm_vm2_raise2.rb
deleted file mode 100644
index 1f61c63157..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_raise2.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_regexp.rb b/ruby_2_2/benchmark/bm_vm2_regexp.rb
deleted file mode 100644
index 55f9e957a3..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_regexp.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-i = 0
-str = 'xxxhogexxx'
-while i<6_000_000 # benchmark loop 2
- /hoge/ =~ str
- i += 1
-end
diff --git a/ruby_2_2/benchmark/bm_vm2_send.rb b/ruby_2_2/benchmark/bm_vm2_send.rb
deleted file mode 100644
index 6a3ab6fdab..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_send.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_struct_big_aref_hi.rb b/ruby_2_2/benchmark/bm_vm2_struct_big_aref_hi.rb
deleted file mode 100644
index 22cb26b0a5..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_struct_big_aref_hi.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(*('a'..'z').map { |x| x.to_sym })
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x.z # x[25]
-end
diff --git a/ruby_2_2/benchmark/bm_vm2_struct_big_aref_lo.rb b/ruby_2_2/benchmark/bm_vm2_struct_big_aref_lo.rb
deleted file mode 100644
index 5e61a7087e..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_struct_big_aref_lo.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(*('a'..'z').map { |x| x.to_sym })
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x.k # x[10]
-end
diff --git a/ruby_2_2/benchmark/bm_vm2_struct_big_aset.rb b/ruby_2_2/benchmark/bm_vm2_struct_big_aset.rb
deleted file mode 100644
index 5a1c3d16f3..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_struct_big_aset.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(*('a'..'z').map { |x| x.to_sym })
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x.k = i # x[10] = i
-end
diff --git a/ruby_2_2/benchmark/bm_vm2_struct_small_aref.rb b/ruby_2_2/benchmark/bm_vm2_struct_small_aref.rb
deleted file mode 100644
index 8eaa555b41..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_struct_small_aref.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(:a, :b, :c)
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x.a
-end
diff --git a/ruby_2_2/benchmark/bm_vm2_struct_small_aset.rb b/ruby_2_2/benchmark/bm_vm2_struct_small_aset.rb
deleted file mode 100644
index ecd0f95669..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_struct_small_aset.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-s = Struct.new(:a, :b, :c)
-x = s.new
-i = 0
-while i<6_000_000 # benchmark loop 2
- i += 1
- x.a = i
-end
diff --git a/ruby_2_2/benchmark/bm_vm2_super.rb b/ruby_2_2/benchmark/bm_vm2_super.rb
deleted file mode 100644
index afd8579e7b..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_super.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-
-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
diff --git a/ruby_2_2/benchmark/bm_vm2_unif1.rb b/ruby_2_2/benchmark/bm_vm2_unif1.rb
deleted file mode 100644
index 1774625942..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_unif1.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-i = 0
-def m a, b
-end
-
-while i<6_000_000 # benchmark loop 2
- i += 1
- m 100, 200
-end
diff --git a/ruby_2_2/benchmark/bm_vm2_zsuper.rb b/ruby_2_2/benchmark/bm_vm2_zsuper.rb
deleted file mode 100644
index 2a43e62217..0000000000
--- a/ruby_2_2/benchmark/bm_vm2_zsuper.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/bm_vm3_backtrace.rb b/ruby_2_2/benchmark/bm_vm3_backtrace.rb
deleted file mode 100644
index 0fbf73e1ca..0000000000
--- a/ruby_2_2/benchmark/bm_vm3_backtrace.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# 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
diff --git a/ruby_2_2/benchmark/bm_vm3_clearmethodcache.rb b/ruby_2_2/benchmark/bm_vm3_clearmethodcache.rb
deleted file mode 100644
index 9661323cd2..0000000000
--- a/ruby_2_2/benchmark/bm_vm3_clearmethodcache.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-i = 0
-while i<200_000
- i += 1
-
- Class.new{
- def m; end
- }
-end
diff --git a/ruby_2_2/benchmark/bm_vm3_gc.rb b/ruby_2_2/benchmark/bm_vm3_gc.rb
deleted file mode 100755
index 7db9829d44..0000000000
--- a/ruby_2_2/benchmark/bm_vm3_gc.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-#! /usr/bin/ruby
-5000.times do
- 100.times do
- {"xxxx"=>"yyyy"}
- end
- GC.start
-end
diff --git a/ruby_2_2/benchmark/bm_vm_thread_alive_check1.rb b/ruby_2_2/benchmark/bm_vm_thread_alive_check1.rb
deleted file mode 100644
index c993accdda..0000000000
--- a/ruby_2_2/benchmark/bm_vm_thread_alive_check1.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-5_000.times{
- t = Thread.new{}
- while t.alive?
- Thread.pass
- end
-}
diff --git a/ruby_2_2/benchmark/bm_vm_thread_close.rb b/ruby_2_2/benchmark/bm_vm_thread_close.rb
deleted file mode 100644
index 3e9a265ce8..0000000000
--- a/ruby_2_2/benchmark/bm_vm_thread_close.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-1000.times { Thread.new { sleep } }
-i = 0
-while i<100_000 # benchmark loop 3
- i += 1
- IO.pipe.each(&:close)
-end
diff --git a/ruby_2_2/benchmark/bm_vm_thread_create_join.rb b/ruby_2_2/benchmark/bm_vm_thread_create_join.rb
deleted file mode 100644
index 393cd45df9..0000000000
--- a/ruby_2_2/benchmark/bm_vm_thread_create_join.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-i = 0
-while i<100_000 # benchmark loop 3
- i += 1
- Thread.new{
- }.join
-end
diff --git a/ruby_2_2/benchmark/bm_vm_thread_mutex1.rb b/ruby_2_2/benchmark/bm_vm_thread_mutex1.rb
deleted file mode 100644
index 5c9f85dfb7..0000000000
--- a/ruby_2_2/benchmark/bm_vm_thread_mutex1.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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
diff --git a/ruby_2_2/benchmark/bm_vm_thread_mutex2.rb b/ruby_2_2/benchmark/bm_vm_thread_mutex2.rb
deleted file mode 100644
index 10de59054f..0000000000
--- a/ruby_2_2/benchmark/bm_vm_thread_mutex2.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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
diff --git a/ruby_2_2/benchmark/bm_vm_thread_mutex3.rb b/ruby_2_2/benchmark/bm_vm_thread_mutex3.rb
deleted file mode 100644
index 7f9a44b39d..0000000000
--- a/ruby_2_2/benchmark/bm_vm_thread_mutex3.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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
diff --git a/ruby_2_2/benchmark/bm_vm_thread_pass.rb b/ruby_2_2/benchmark/bm_vm_thread_pass.rb
deleted file mode 100644
index b5b3c0bc85..0000000000
--- a/ruby_2_2/benchmark/bm_vm_thread_pass.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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}
-
-
diff --git a/ruby_2_2/benchmark/bm_vm_thread_pass_flood.rb b/ruby_2_2/benchmark/bm_vm_thread_pass_flood.rb
deleted file mode 100644
index 27157d1a6f..0000000000
--- a/ruby_2_2/benchmark/bm_vm_thread_pass_flood.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-1000.times{
- Thread.new{loop{Thread.pass}}
-}
-
-i = 0
-while i<10000
- i += 1
-end
diff --git a/ruby_2_2/benchmark/bm_vm_thread_pipe.rb b/ruby_2_2/benchmark/bm_vm_thread_pipe.rb
deleted file mode 100644
index 272d231eba..0000000000
--- a/ruby_2_2/benchmark/bm_vm_thread_pipe.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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}
-
diff --git a/ruby_2_2/benchmark/bm_vm_thread_queue.rb b/ruby_2_2/benchmark/bm_vm_thread_queue.rb
deleted file mode 100644
index 37381ae62b..0000000000
--- a/ruby_2_2/benchmark/bm_vm_thread_queue.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-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
diff --git a/ruby_2_2/benchmark/driver.rb b/ruby_2_2/benchmark/driver.rb
deleted file mode 100644
index 3904e25503..0000000000
--- a/ruby_2_2/benchmark/driver.rb
+++ /dev/null
@@ -1,321 +0,0 @@
-#
-# Ruby Benchmark driver
-#
-
-first = true
-
-begin
- require 'optparse'
-rescue LoadError
- if first
- first = false
- $:.unshift File.join(File.dirname(__FILE__), '../lib')
- retry
- else
- raise
- end
-end
-
-require 'benchmark'
-require 'pp'
-
-class BenchmarkDriver
- def self.benchmark(opt)
- driver = self.new(opt[:execs], opt[:dir], opt)
- begin
- driver.run
- ensure
- driver.show_results
- end
- end
-
- def output *args
- puts(*args)
- @output and @output.puts(*args)
- end
-
- def message *args
- output(*args) if @verbose
- end
-
- def message_print *args
- if @verbose
- print(*args)
- STDOUT.flush
- @output and @output.print(*args)
- end
- end
-
- def progress_message *args
- unless STDOUT.tty?
- STDERR.print(*args)
- STDERR.flush
- end
- end
-
- def initialize execs, dir, opt = {}
- @execs = execs.map{|e|
- e.strip!
- next if e.empty?
-
- if /(.+)::(.+)/ =~ e
- # ex) ruby-a::/path/to/ruby-a
- label = $1.strip
- path = $2
- version = `#{path} -v`.chomp
- else
- path = e
- version = label = `#{path} -v`.chomp
- end
- [path, label, version]
- }.compact
-
- @dir = dir
- @repeat = opt[:repeat] || 1
- @repeat = 1 if @repeat < 1
- @pattern = opt[:pattern] || nil
- @exclude = opt[:exclude] || nil
- @verbose = opt[:quiet] ? false : (opt[:verbose] || false)
- @output = opt[:output] ? open(opt[:output], 'w') : nil
- @rawdata_output = opt[:rawdata_output] ? open(opt[:rawdata_output], 'w') : nil
- @loop_wl1 = @loop_wl2 = nil
- @ruby_arg = opt[:ruby_arg] || nil
- @opt = opt
-
- # [[name, [[r-1-1, r-1-2, ...], [r-2-1, r-2-2, ...]]], ...]
- @results = []
-
- if @verbose
- @start_time = Time.now
- message @start_time
- @execs.each_with_index{|(path, label, version), i|
- message "target #{i}: " + (label == version ? "#{label}" : "#{label} (#{version})") + " at \"#{path}\""
- }
- end
- end
-
- def adjusted_results name, results
- s = nil
- results.each_with_index{|e, i|
- r = e.min
- case name
- when /^vm1_/
- if @loop_wl1
- r -= @loop_wl1[i]
- r = 0 if r < 0
- s = '*'
- end
- when /^vm2_/
- if @loop_wl2
- r -= @loop_wl2[i]
- r = 0 if r < 0
- s = '*'
- end
- end
- yield r
- }
- s
- end
-
- def show_results
- output
-
- if @verbose
- message '-----------------------------------------------------------'
- message 'raw data:'
- message
- message PP.pp(@results, "", 79)
- message
- message "Elapsed time: #{Time.now - @start_time} (sec)"
- end
-
- if @rawdata_output
- h = {}
- h[:cpuinfo] = File.read('/proc/cpuinfo') if File.exist?('/proc/cpuinfo')
- h[:executables] = @execs
- h[:results] = @results
- @rawdata_output.puts h.inspect
- end
-
- output '-----------------------------------------------------------'
- output 'benchmark results:'
-
- if @verbose and @repeat > 1
- output "minimum results in each #{@repeat} measurements."
- end
-
- output "Execution time (sec)"
- output "name\t#{@execs.map{|(_, v)| v}.join("\t")}"
- @results.each{|v, result|
- rets = []
- s = adjusted_results(v, result){|r|
- rets << sprintf("%.3f", r)
- }
- output "#{v}#{s}\t#{rets.join("\t")}"
- }
-
- if @execs.size > 1
- output
- output "Speedup ratio: compare with the result of `#{@execs[0][1]}' (greater is better)"
- output "name\t#{@execs[1..-1].map{|(_, v)| v}.join("\t")}"
- @results.each{|v, result|
- rets = []
- first_value = nil
- s = adjusted_results(v, result){|r|
- if first_value
- if r == 0
- rets << "Error"
- else
- rets << sprintf("%.3f", first_value/r)
- end
- else
- first_value = r
- end
- }
- output "#{v}#{s}\t#{rets.join("\t")}"
- }
- end
-
- if @opt[:output]
- output
- output "Log file: #{@opt[:output]}"
- end
- end
-
- def files
- flag = {}
- @files = Dir.glob(File.join(@dir, 'bm*.rb')).map{|file|
- next if @pattern && /#{@pattern}/ !~ File.basename(file)
- next if @exclude && /#{@exclude}/ =~ File.basename(file)
- case file
- when /bm_(vm[12])_/, /bm_loop_(whileloop2?).rb/
- flag[$1] = true
- end
- file
- }.compact
-
- if flag['vm1'] && !flag['whileloop']
- @files << File.join(@dir, 'bm_loop_whileloop.rb')
- elsif flag['vm2'] && !flag['whileloop2']
- @files << File.join(@dir, 'bm_loop_whileloop2.rb')
- end
-
- @files.sort!
- progress_message "total: #{@files.size * @repeat} trial(s) (#{@repeat} trial(s) for #{@files.size} benchmark(s))\n"
- @files
- end
-
- def run
- files.each_with_index{|file, i|
- @i = i
- r = measure_file(file)
-
- if /bm_loop_whileloop.rb/ =~ file
- @loop_wl1 = r[1].map{|e| e.min}
- elsif /bm_loop_whileloop2.rb/ =~ file
- @loop_wl2 = r[1].map{|e| e.min}
- end
- }
- end
-
- def measure_file file
- name = File.basename(file, '.rb').sub(/^bm_/, '')
- prepare_file = File.join(File.dirname(file), "prepare_#{name}.rb")
- load prepare_file if FileTest.exist?(prepare_file)
-
- if @verbose
- output
- output '-----------------------------------------------------------'
- output name
- output
- output File.read(file)
- output
- end
-
- result = [name]
- result << @execs.map{|(e, v)|
- (0...@repeat).map{
- message_print "#{v}\t"
- progress_message '.'
-
- m = measure(e, file)
- message "#{m}"
- m
- }
- }
- @results << result
- result
- end
-
- unless defined?(File::NULL)
- if File.exist?('/dev/null')
- File::NULL = '/dev/null'
- end
- end
-
- def measure executable, file
- cmd = "#{executable} #{@ruby_arg} #{file}"
-
- m = Benchmark.measure{
- system(cmd, out: File::NULL)
- }
-
- if $? != 0
- output "\`#{cmd}\' exited with abnormal status (#{$?})"
- 0
- else
- m.real
- end
- end
-end
-
-if __FILE__ == $0
- opt = {
- :execs => [],
- :dir => File.dirname(__FILE__),
- :repeat => 1,
- :output => "bmlog-#{Time.now.strftime('%Y%m%d-%H%M%S')}.#{$$}",
- :raw_output => nil
- }
-
- parser = OptionParser.new{|o|
- o.on('-e', '--executables [EXECS]',
- "Specify benchmark one or more targets (e1::path1; e2::path2; e3::path3;...)"){|e|
- e.split(/;/).each{|path|
- opt[:execs] << path
- }
- }
- o.on('-d', '--directory [DIRECTORY]', "Benchmark suites directory"){|d|
- opt[:dir] = d
- }
- o.on('-p', '--pattern [PATTERN]', "Benchmark name pattern"){|p|
- opt[:pattern] = p
- }
- o.on('-x', '--exclude [PATTERN]', "Benchmark exclude pattern"){|e|
- opt[:exclude] = e
- }
- o.on('-r', '--repeat-count [NUM]', "Repeat count"){|n|
- opt[:repeat] = n.to_i
- }
- o.on('-o', '--output-file [FILE]', "Output file"){|f|
- opt[:output] = f
- }
- o.on('--ruby-arg [ARG]', "Optional argument for ruby"){|a|
- opt[:ruby_arg] = a
- }
- o.on('--rawdata-output [FILE]', 'output rawdata'){|r|
- opt[:rawdata_output] = r
- }
- o.on('-v', '--verbose'){|v|
- opt[:verbose] = v
- }
- o.on('-q', '--quiet', "Run without notify information except result table."){|q|
- opt[:quiet] = q
- opt[:verbose] = false
- }
- }
-
- parser.parse!(ARGV)
- BenchmarkDriver.benchmark(opt)
-end
-
diff --git a/ruby_2_2/benchmark/gc/aobench.rb b/ruby_2_2/benchmark/gc/aobench.rb
deleted file mode 100644
index 2eed7abc83..0000000000
--- a/ruby_2_2/benchmark/gc/aobench.rb
+++ /dev/null
@@ -1 +0,0 @@
-require_relative '../bm_app_aobench.rb'
diff --git a/ruby_2_2/benchmark/gc/binary_trees.rb b/ruby_2_2/benchmark/gc/binary_trees.rb
deleted file mode 100644
index af8ea722aa..0000000000
--- a/ruby_2_2/benchmark/gc/binary_trees.rb
+++ /dev/null
@@ -1 +0,0 @@
-require_relative '../bm_so_binary_trees.rb'
diff --git a/ruby_2_2/benchmark/gc/gcbench.rb b/ruby_2_2/benchmark/gc/gcbench.rb
deleted file mode 100644
index 09a404466a..0000000000
--- a/ruby_2_2/benchmark/gc/gcbench.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-require 'benchmark'
-require 'pp'
-require 'optparse'
-
-$list = true
-$gcprof = true
-
-opt = OptionParser.new
-opt.on('-q'){$list = false}
-opt.on('-d'){$gcprof = false}
-opt.parse!(ARGV)
-
-script = File.join(File.dirname(__FILE__), ARGV.shift)
-script += '.rb' unless FileTest.exist?(script)
-raise "#{script} not found" unless FileTest.exist?(script)
-
-puts "Script: #{script}"
-
-if $gcprof
- GC::Profiler.enable
-end
-
-tms = Benchmark.measure{|x|
- load script
-}
-
-gc_time = 0
-
-if $gcprof
- gc_time = GC::Profiler.total_time
- GC::Profiler.report if $list and RUBY_VERSION >= '2.0.0' # before 1.9.3, report() may run infinite loop
- GC::Profiler.disable
-end
-
-pp GC.stat
-
-puts "#{RUBY_DESCRIPTION} #{GC::OPTS.inspect}" if defined?(GC::OPTS)
-
-desc = "#{RUBY_VERSION}#{RUBY_PATCHLEVEL >= 0 ? "p#{RUBY_PATCHLEVEL}" : "dev"}"
-name = File.basename(script, '.rb')
-
-puts
-puts script
-puts Benchmark::CAPTION
-puts tms
-puts "GC total time (sec): #{gc_time}"
-
-# show High-Water Mark on Linux
-if File.exist?('/proc/self/status') && /VmHWM:\s*(\d+.+)/ =~ File.read('/proc/self/status')
- puts
- puts "VmHWM: #{$1.chomp}"
-end
-
-puts
-puts "Summary of #{name} on #{desc}\t#{tms.real}\t#{gc_time}\t#{GC.count}"
-puts " (real time in sec, GC time in sec, GC count)"
diff --git a/ruby_2_2/benchmark/gc/hash1.rb b/ruby_2_2/benchmark/gc/hash1.rb
deleted file mode 100644
index cb030d458d..0000000000
--- a/ruby_2_2/benchmark/gc/hash1.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-value = 0.01
-h = {}
-n = 50_000
-
-1.upto(n){|i|
- h["%020d" % i] = "v-#{i}"
-}
-
-(n * 1_000).times{
- ''
-}
diff --git a/ruby_2_2/benchmark/gc/hash2.rb b/ruby_2_2/benchmark/gc/hash2.rb
deleted file mode 100644
index e8c943fb21..0000000000
--- a/ruby_2_2/benchmark/gc/hash2.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-value = 0.01
-h = {}
-n = 4*(10**6)
-
-1.upto(n){|i|
- h["%020d" % i] = value * i
-}
diff --git a/ruby_2_2/benchmark/gc/null.rb b/ruby_2_2/benchmark/gc/null.rb
deleted file mode 100644
index c05a79f561..0000000000
--- a/ruby_2_2/benchmark/gc/null.rb
+++ /dev/null
@@ -1 +0,0 @@
-# null
diff --git a/ruby_2_2/benchmark/gc/pentomino.rb b/ruby_2_2/benchmark/gc/pentomino.rb
deleted file mode 100644
index 94ba74be89..0000000000
--- a/ruby_2_2/benchmark/gc/pentomino.rb
+++ /dev/null
@@ -1 +0,0 @@
-require_relative '../bm_app_pentomino.rb'
diff --git a/ruby_2_2/benchmark/gc/rdoc.rb b/ruby_2_2/benchmark/gc/rdoc.rb
deleted file mode 100644
index 14c89f5611..0000000000
--- a/ruby_2_2/benchmark/gc/rdoc.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require 'rdoc/rdoc'
-require 'tmpdir'
-
-srcdir = File.expand_path('../..', __dir__)
-
-Dir.mktmpdir('rdocbench-'){|d|
- dir = File.join(d, 'rdocbench')
- args = %W(--root #{srcdir} --page-dir #{srcdir}/doc --encoding=UTF-8 --no-force-update --all --ri --debug --quiet #{srcdir})
- args << '--op' << dir
-
- r = RDoc::RDoc.new
- r.document args
-}
diff --git a/ruby_2_2/benchmark/gc/redblack.rb b/ruby_2_2/benchmark/gc/redblack.rb
deleted file mode 100644
index c66290140a..0000000000
--- a/ruby_2_2/benchmark/gc/redblack.rb
+++ /dev/null
@@ -1,366 +0,0 @@
-# This benchmark is imported from https://github.com/jruby/rubybench/blob/master/time/bench_red_black.rb
-# License is License is Apache-2
-
-require 'benchmark'
-
-# Algorithm based on "Introduction to Algorithms" by Cormen and others
-class RedBlackTree
- class Node
- attr_accessor :color
- attr_accessor :key
- attr_accessor :left
- attr_accessor :right
- attr_accessor :parent
-
- RED = :red
- BLACK = :black
- COLORS = [RED, BLACK].freeze
-
- def initialize(key, color = RED)
- raise ArgumentError, "Bad value for color parameter" unless COLORS.include?(color)
- @color = color
- @key = key
- @left = @right = @parent = NilNode.instance
- end
-
- def black?
- return color == BLACK
- end
-
- def red?
- return color == RED
- end
- end
-
- class NilNode < Node
- class << self
- private :new
-
- # it's not thread safe
- def instance
- @instance ||= begin
- def instance
- return @instance
- end
-
- new
- end
- end
- end
-
- def initialize
- self.color = BLACK
- self.key = 0
- self.left = nil
- self.right = nil
- self.parent = nil
- end
-
- def nil?
- return true
- end
- end
-
- include Enumerable
-
- attr_accessor :root
- attr_accessor :size
-
- def initialize
- self.root = NilNode.instance
- self.size = 0
- end
-
- def add(key)
- insert(Node.new(key))
- end
-
- def insert(x)
- insert_helper(x)
-
- x.color = Node::RED
- while x != root && x.parent.color == Node::RED
- if x.parent == x.parent.parent.left
- y = x.parent.parent.right
- if !y.nil? && y.color == Node::RED
- x.parent.color = Node::BLACK
- y.color = Node::BLACK
- x.parent.parent.color = Node::RED
- x = x.parent.parent
- else
- if x == x.parent.right
- x = x.parent
- left_rotate(x)
- end
- x.parent.color = Node::BLACK
- x.parent.parent.color = Node::RED
- right_rotate(x.parent.parent)
- end
- else
- y = x.parent.parent.left
- if !y.nil? && y.color == Node::RED
- x.parent.color = Node::BLACK
- y.color = Node::BLACK
- x.parent.parent.color = Node::RED
- x = x.parent.parent
- else
- if x == x.parent.left
- x = x.parent
- right_rotate(x)
- end
- x.parent.color = Node::BLACK
- x.parent.parent.color = Node::RED
- left_rotate(x.parent.parent)
- end
- end
- end
- root.color = Node::BLACK
- end
-
- alias << insert
-
- def delete(z)
- y = (z.left.nil? || z.right.nil?) ? z : successor(z)
- x = y.left.nil? ? y.right : y.left
- x.parent = y.parent
-
- if y.parent.nil?
- self.root = x
- else
- if y == y.parent.left
- y.parent.left = x
- else
- y.parent.right = x
- end
- end
-
- z.key = y.key if y != z
-
- if y.color == Node::BLACK
- delete_fixup(x)
- end
-
- self.size -= 1
- return y
- end
-
- def minimum(x = root)
- while !x.left.nil?
- x = x.left
- end
- return x
- end
-
- def maximum(x = root)
- while !x.right.nil?
- x = x.right
- end
- return x
- end
-
- def successor(x)
- if !x.right.nil?
- return minimum(x.right)
- end
- y = x.parent
- while !y.nil? && x == y.right
- x = y
- y = y.parent
- end
- return y
- end
-
- def predecessor(x)
- if !x.left.nil?
- return maximum(x.left)
- end
- y = x.parent
- while !y.nil? && x == y.left
- x = y
- y = y.parent
- end
- return y
- end
-
- def inorder_walk(x = root)
- x = self.minimum
- while !x.nil?
- yield x.key
- x = successor(x)
- end
- end
-
- alias each inorder_walk
-
- def reverse_inorder_walk(x = root)
- x = self.maximum
- while !x.nil?
- yield x.key
- x = predecessor(x)
- end
- end
-
- alias reverse_each reverse_inorder_walk
-
- def search(key, x = root)
- while !x.nil? && x.key != key
- key < x.key ? x = x.left : x = x.right
- end
- return x
- end
-
- def empty?
- return self.root.nil?
- end
-
- def black_height(x = root)
- height = 0
- while !x.nil?
- x = x.left
- height +=1 if x.nil? || x.black?
- end
- return height
- end
-
-private
-
- def left_rotate(x)
- raise "x.right is nil!" if x.right.nil?
- y = x.right
- x.right = y.left
- y.left.parent = x if !y.left.nil?
- y.parent = x.parent
- if x.parent.nil?
- self.root = y
- else
- if x == x.parent.left
- x.parent.left = y
- else
- x.parent.right = y
- end
- end
- y.left = x
- x.parent = y
- end
-
- def right_rotate(x)
- raise "x.left is nil!" if x.left.nil?
- y = x.left
- x.left = y.right
- y.right.parent = x if !y.right.nil?
- y.parent = x.parent
- if x.parent.nil?
- self.root = y
- else
- if x == x.parent.left
- x.parent.left = y
- else
- x.parent.right = y
- end
- end
- y.right = x
- x.parent = y
- end
-
- def insert_helper(z)
- y = NilNode.instance
- x = root
- while !x.nil?
- y = x
- z.key < x.key ? x = x.left : x = x.right
- end
- z.parent = y
- if y.nil?
- self.root = z
- else
- z.key < y.key ? y.left = z : y.right = z
- end
- self.size += 1
- end
-
- def delete_fixup(x)
- while x != root && x.color == Node::BLACK
- if x == x.parent.left
- w = x.parent.right
- if w.color == Node::RED
- w.color = Node::BLACK
- x.parent.color = Node::RED
- left_rotate(x.parent)
- w = x.parent.right
- end
- if w.left.color == Node::BLACK && w.right.color == Node::BLACK
- w.color = Node::RED
- x = x.parent
- else
- if w.right.color == Node::BLACK
- w.left.color = Node::BLACK
- w.color = Node::RED
- right_rotate(w)
- w = x.parent.right
- end
- w.color = x.parent.color
- x.parent.color = Node::BLACK
- w.right.color = Node::BLACK
- left_rotate(x.parent)
- x = root
- end
- else
- w = x.parent.left
- if w.color == Node::RED
- w.color = Node::BLACK
- x.parent.color = Node::RED
- right_rotate(x.parent)
- w = x.parent.left
- end
- if w.right.color == Node::BLACK && w.left.color == Node::BLACK
- w.color = Node::RED
- x = x.parent
- else
- if w.left.color == Node::BLACK
- w.right.color = Node::BLACK
- w.color = Node::RED
- left_rotate(w)
- w = x.parent.left
- end
- w.color = x.parent.color
- x.parent.color = Node::BLACK
- w.left.color = Node::BLACK
- right_rotate(x.parent)
- x = root
- end
- end
- end
- x.color = Node::BLACK
- end
-end
-
-def rbt_bm
- n = 100_000
- a1 = []; n.times { a1 << rand(999_999) }
- a2 = []; n.times { a2 << rand(999_999) }
-
- start = Time.now
-
- tree = RedBlackTree.new
-
- n.times {|i| tree.add(i) }
- n.times { tree.delete(tree.root) }
-
- tree = RedBlackTree.new
- a1.each {|e| tree.add(e) }
- a2.each {|e| tree.search(e) }
- tree.inorder_walk {|key| key + 1 }
- tree.reverse_inorder_walk {|key| key + 1 }
- n.times { tree.minimum }
- n.times { tree.maximum }
-
- return Time.now - start
-end
-
-N = (ARGV[0] || 10).to_i
-
-N.times do
- # puts rbt_bm.to_f
- rbt_bm.to_f
- # puts "GC.count = #{GC.count}" if GC.respond_to?(:count)
-end
diff --git a/ruby_2_2/benchmark/gc/ring.rb b/ruby_2_2/benchmark/gc/ring.rb
deleted file mode 100644
index be2c7b7250..0000000000
--- a/ruby_2_2/benchmark/gc/ring.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# create many old objects
-
-max = 30_000_000
-
-class Ring
- attr_reader :next_ring
- def initialize n = nil
- @next_ring = n
- end
-
-
- def size
- s = 1
- ring = self
- while ring.next_ring
- s += 1
- ring = ring.next_ring
- end
- s
- end
-end
-
-ring = Ring.new
-
-max.times{
- ring = Ring.new(ring)
-}
-
-# p ring.size
diff --git a/ruby_2_2/benchmark/make_fasta_output.rb b/ruby_2_2/benchmark/make_fasta_output.rb
deleted file mode 100644
index b6d787ae27..0000000000
--- a/ruby_2_2/benchmark/make_fasta_output.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# prepare 'fasta.output'
-
-def prepare_fasta_output n
- filebase = File.join(File.dirname($0), 'fasta.output')
- script = File.join(File.dirname($0), 'bm_so_fasta.rb')
- file = "#{filebase}.#{n}"
-
- unless FileTest.exist?(file)
- STDERR.puts "preparing #{file}"
-
- open(file, 'w'){|f|
- ARGV[0] = n
- $stdout = f
- load script
- $stdout = STDOUT
- }
- end
-end
-
diff --git a/ruby_2_2/benchmark/other-lang/ack.pl b/ruby_2_2/benchmark/other-lang/ack.pl
deleted file mode 100644
index 201e22ddfa..0000000000
--- a/ruby_2_2/benchmark/other-lang/ack.pl
+++ /dev/null
@@ -1,11 +0,0 @@
-use integer;
-
-sub Ack {
- return $_[0] ? ($_[1] ? Ack($_[0]-1, Ack($_[0], $_[1]-1))
- : Ack($_[0]-1, 1))
- : $_[1]+1;
-}
-
-my $NUM = 9;
-$NUM = 1 if ($NUM < 1);
-my $ack = Ack(3, $NUM);
diff --git a/ruby_2_2/benchmark/other-lang/ack.py b/ruby_2_2/benchmark/other-lang/ack.py
deleted file mode 100644
index 9968e7cfcf..0000000000
--- a/ruby_2_2/benchmark/other-lang/ack.py
+++ /dev/null
@@ -1,16 +0,0 @@
-import sys
-sys.setrecursionlimit(5000000)
-
-def Ack(M, N):
- if (not M):
- return( N + 1 )
- if (not N):
- return( Ack(M-1, 1) )
- return( Ack(M-1, Ack(M, N-1)) )
-
-def main():
- NUM = 9
- sys.setrecursionlimit(10000)
- Ack(3, NUM)
-
-main()
diff --git a/ruby_2_2/benchmark/other-lang/ack.rb b/ruby_2_2/benchmark/other-lang/ack.rb
deleted file mode 100644
index 7451bed6c4..0000000000
--- a/ruby_2_2/benchmark/other-lang/ack.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-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)
diff --git a/ruby_2_2/benchmark/other-lang/ack.scm b/ruby_2_2/benchmark/other-lang/ack.scm
deleted file mode 100644
index a80b73ba55..0000000000
--- a/ruby_2_2/benchmark/other-lang/ack.scm
+++ /dev/null
@@ -1,7 +0,0 @@
-(define (ack m n)
- (cond ((zero? m) (+ n 1))
- ((zero? n) (ack (- m 1) 1))
- (else (ack (- m 1) (ack m (- n 1))))))
-
-(ack 3 9)
-
diff --git a/ruby_2_2/benchmark/other-lang/eval.rb b/ruby_2_2/benchmark/other-lang/eval.rb
deleted file mode 100644
index 48a2cea019..0000000000
--- a/ruby_2_2/benchmark/other-lang/eval.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-
-Bench = %w(
- loop
- ack
- fib
- tak
- fact
-)
-
-Lang = <<EOP.map{|l| l.strip}
- ruby-cyg
- ../../../test6/miniruby
- perl
- python
- gosh
-EOP
-
-Bench.replace ['loop2']
-Lang.replace ['ruby-cyg']
-
-Ext = %w(
- .rb
- .rb
- .pl
- .py
- .scm
-)
-
-p Bench
-p Lang
-
-require 'benchmark'
-
-def bench cmd
- m = Benchmark.measure{
- #p cmd
- system(cmd)
- }
- [m.utime, m.real]
-end
-
-Result = []
-Bench.each{|b|
- r = []
- Lang.each_with_index{|l, idx|
- cmd = "#{l} #{b}#{Ext[idx]}"
- r << bench(cmd)
- }
- Result << r
-}
-
-require 'pp'
-# utime
-puts Lang.join("\t")
-Bench.each_with_index{|b, bi|
- print b, "\t"
- puts Result[bi].map{|e| e[0]}.join("\t")
-}
-
-# rtime
-puts Lang.join("\t")
-Bench.each_with_index{|b, bi|
- print b, "\t"
- puts Result[bi].map{|e| e[1]}.join("\t")
-}
-
diff --git a/ruby_2_2/benchmark/other-lang/fact.pl b/ruby_2_2/benchmark/other-lang/fact.pl
deleted file mode 100644
index a9b0b69cdf..0000000000
--- a/ruby_2_2/benchmark/other-lang/fact.pl
+++ /dev/null
@@ -1,13 +0,0 @@
-sub fact{
- my $n = @_[0];
- if($n < 2){
- return 1;
- }
- else{
- return $n * fact($n-1);
- }
-}
-
-for($i=0; $i<10000; $i++){
- &fact(100);
-}
diff --git a/ruby_2_2/benchmark/other-lang/fact.py b/ruby_2_2/benchmark/other-lang/fact.py
deleted file mode 100644
index 01593965d9..0000000000
--- a/ruby_2_2/benchmark/other-lang/fact.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#import sys
-#sys.setrecursionlimit(1000)
-
-def factL(n):
- r = 1
- for x in range(2, n):
- r *= x
- return r
-
-def factR(n):
- if n < 2:
- return 1
- else:
- return n * factR(n-1)
-
-for i in range(10000):
- factR(100)
-
diff --git a/ruby_2_2/benchmark/other-lang/fact.rb b/ruby_2_2/benchmark/other-lang/fact.rb
deleted file mode 100644
index 6cedc752cd..0000000000
--- a/ruby_2_2/benchmark/other-lang/fact.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-def fact(n)
- if n < 2
- 1
- else
- n * fact(n-1)
- end
-end
-
-i = 0
-while i<10000
- i += 1
- fact(100)
-end
diff --git a/ruby_2_2/benchmark/other-lang/fact.scm b/ruby_2_2/benchmark/other-lang/fact.scm
deleted file mode 100644
index c98a7fedd3..0000000000
--- a/ruby_2_2/benchmark/other-lang/fact.scm
+++ /dev/null
@@ -1,8 +0,0 @@
-(define (fact n)
- (if (< n 2)
- 1
- (* n (fact (- n 1)))))
-
-(dotimes (i 10000)
- (fact 100))
-
diff --git a/ruby_2_2/benchmark/other-lang/fib.pl b/ruby_2_2/benchmark/other-lang/fib.pl
deleted file mode 100644
index a46f666d1e..0000000000
--- a/ruby_2_2/benchmark/other-lang/fib.pl
+++ /dev/null
@@ -1,11 +0,0 @@
-sub fib{
- my $n = $_[0];
- if($n < 3){
- return 1;
- }
- else{
- return fib($n-1) + fib($n-2);
- }
-};
-
-&fib(34);
diff --git a/ruby_2_2/benchmark/other-lang/fib.py b/ruby_2_2/benchmark/other-lang/fib.py
deleted file mode 100644
index 45f2bceb8d..0000000000
--- a/ruby_2_2/benchmark/other-lang/fib.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def fib(n):
- if n < 3:
- return 1
- else:
- return fib(n-1) + fib(n-2)
-
-fib(34)
diff --git a/ruby_2_2/benchmark/other-lang/fib.rb b/ruby_2_2/benchmark/other-lang/fib.rb
deleted file mode 100644
index ec587eabe0..0000000000
--- a/ruby_2_2/benchmark/other-lang/fib.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-def fib n
- if n < 3
- 1
- else
- fib(n-1) + fib(n-2)
- end
-end
-
-fib(34)
diff --git a/ruby_2_2/benchmark/other-lang/fib.scm b/ruby_2_2/benchmark/other-lang/fib.scm
deleted file mode 100644
index 2fc4e225bd..0000000000
--- a/ruby_2_2/benchmark/other-lang/fib.scm
+++ /dev/null
@@ -1,7 +0,0 @@
-(define (fib n)
- (if (< n 3)
- 1
- (+ (fib (- n 1)) (fib (- n 2)))))
-
-(fib 34)
-
diff --git a/ruby_2_2/benchmark/other-lang/loop.pl b/ruby_2_2/benchmark/other-lang/loop.pl
deleted file mode 100644
index 2777490aaa..0000000000
--- a/ruby_2_2/benchmark/other-lang/loop.pl
+++ /dev/null
@@ -1,3 +0,0 @@
-for($i=0; $i<30000000; $i++){
-}
-
diff --git a/ruby_2_2/benchmark/other-lang/loop.py b/ruby_2_2/benchmark/other-lang/loop.py
deleted file mode 100644
index 003749bf3a..0000000000
--- a/ruby_2_2/benchmark/other-lang/loop.py
+++ /dev/null
@@ -1,2 +0,0 @@
-for i in xrange(30000000):
- pass
diff --git a/ruby_2_2/benchmark/other-lang/loop.rb b/ruby_2_2/benchmark/other-lang/loop.rb
deleted file mode 100644
index b367b9dbf3..0000000000
--- a/ruby_2_2/benchmark/other-lang/loop.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-i = 0
-while i<30000000
- i += 1
-end
diff --git a/ruby_2_2/benchmark/other-lang/loop.scm b/ruby_2_2/benchmark/other-lang/loop.scm
deleted file mode 100644
index 3364f7e679..0000000000
--- a/ruby_2_2/benchmark/other-lang/loop.scm
+++ /dev/null
@@ -1 +0,0 @@
-(dotimes (x 30000000))
diff --git a/ruby_2_2/benchmark/other-lang/loop2.rb b/ruby_2_2/benchmark/other-lang/loop2.rb
deleted file mode 100644
index df8fffc1ff..0000000000
--- a/ruby_2_2/benchmark/other-lang/loop2.rb
+++ /dev/null
@@ -1 +0,0 @@
-30000000.times{}
diff --git a/ruby_2_2/benchmark/other-lang/tak.pl b/ruby_2_2/benchmark/other-lang/tak.pl
deleted file mode 100644
index 7e748a67c6..0000000000
--- a/ruby_2_2/benchmark/other-lang/tak.pl
+++ /dev/null
@@ -1,11 +0,0 @@
-sub tak {
- local($x, $y, $z) = @_;
- if (!($y < $x)) {
- return $z;
- } else {
- return &tak(&tak($x - 1, $y, $z),
- &tak($y - 1, $z, $x),
- &tak($z - 1, $x, $y));
- }
-}
-&tak(18, 9, 0);
diff --git a/ruby_2_2/benchmark/other-lang/tak.py b/ruby_2_2/benchmark/other-lang/tak.py
deleted file mode 100644
index 04f3f6829c..0000000000
--- a/ruby_2_2/benchmark/other-lang/tak.py
+++ /dev/null
@@ -1,8 +0,0 @@
-def tak(x, y, z):
- if not(y<x):
- return z
- else:
- return tak(tak(x-1, y, z),
- tak(y-1, z, x),
- tak(z-1, x, y))
-tak(18, 9, 0)
diff --git a/ruby_2_2/benchmark/other-lang/tak.rb b/ruby_2_2/benchmark/other-lang/tak.rb
deleted file mode 100644
index efe5380f4e..0000000000
--- a/ruby_2_2/benchmark/other-lang/tak.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-
-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)
-
diff --git a/ruby_2_2/benchmark/other-lang/tak.scm b/ruby_2_2/benchmark/other-lang/tak.scm
deleted file mode 100644
index 52a7629ee5..0000000000
--- a/ruby_2_2/benchmark/other-lang/tak.scm
+++ /dev/null
@@ -1,10 +0,0 @@
-(define (tak x y z)
- (if (not (< y x))
- z
- (tak (tak (- x 1) y z)
- (tak (- y 1) z x)
- (tak (- z 1) x y))))
-
-(tak 18 9 0)
-
-
diff --git a/ruby_2_2/benchmark/prepare_so_count_words.rb b/ruby_2_2/benchmark/prepare_so_count_words.rb
deleted file mode 100644
index ee2138cdb2..0000000000
--- a/ruby_2_2/benchmark/prepare_so_count_words.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# prepare 'wc.input'
-
-def prepare_wc_input
- wcinput = File.join(File.dirname($0), 'wc.input')
- wcbase = File.join(File.dirname($0), 'wc.input.base')
- unless FileTest.exist?(wcinput)
- data = File.read(wcbase)
- 13.times{
- data << data
- }
- open(wcinput, 'w'){|f| f.write data}
- end
-end
-
-prepare_wc_input
diff --git a/ruby_2_2/benchmark/prepare_so_k_nucleotide.rb b/ruby_2_2/benchmark/prepare_so_k_nucleotide.rb
deleted file mode 100644
index d83aeb7a7e..0000000000
--- a/ruby_2_2/benchmark/prepare_so_k_nucleotide.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative 'make_fasta_output'
-prepare_fasta_output(100_000)
diff --git a/ruby_2_2/benchmark/prepare_so_reverse_complement.rb b/ruby_2_2/benchmark/prepare_so_reverse_complement.rb
deleted file mode 100644
index da3ec2df14..0000000000
--- a/ruby_2_2/benchmark/prepare_so_reverse_complement.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative 'make_fasta_output'
-prepare_fasta_output(2_500_000)
diff --git a/ruby_2_2/benchmark/report.rb b/ruby_2_2/benchmark/report.rb
deleted file mode 100644
index d2dc56b1e1..0000000000
--- a/ruby_2_2/benchmark/report.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-#
-# YARV benchmark driver
-#
-
-require 'yarvutil'
-require 'benchmark'
-require 'rbconfig'
-
-def exec_command type, file, w
- <<-EOP
- $DRIVER_PATH = '#{File.dirname($0)}'
- $LOAD_PATH.replace $LOAD_PATH | #{$LOAD_PATH.inspect}
- require 'benchmark'
- require 'yarvutil'
-# print '#{type}'
- begin
- puts Benchmark.measure{
- #{w}('#{file}')
- }.utime
- rescue Exception => exec_command_error_variable
- puts "\t" + exec_command_error_variable.message
- end
- EOP
-end
-
-def benchmark cmd
- rubybin = ENV['RUBY'] || RbConfig.ruby
-
- IO.popen(rubybin, 'r+'){|io|
- io.write cmd
- io.close_write
- return io.gets
- }
-end
-
-def ruby_exec file
- prog = exec_command 'ruby', file, 'load'
- benchmark prog
-end
-
-def yarv_exec file
- prog = exec_command 'yarv', file, 'YARVUtil.load_bm'
- benchmark prog
-end
-
-$wr = $wy = nil
-
-def measure bench
- file = File.dirname($0) + "/bm_#{bench}.rb"
- r = ruby_exec(file).to_f
- y = yarv_exec(file).to_f
- puts "#{bench}\t#{r}\t#{y}"
-end
-
-def measure2
- r = ruby_exec.to_f
- y = yarv_exec.to_f
- puts r/y
-end
-
-if $0 == __FILE__
- %w{
- whileloop
- whileloop2
- times
- const
- method
- poly_method
- block
- rescue
- rescue2
- }.each{|bench|
- measure bench
- }
-end
-
-
-
-
diff --git a/ruby_2_2/benchmark/run.rb b/ruby_2_2/benchmark/run.rb
deleted file mode 100644
index 0cd2363849..0000000000
--- a/ruby_2_2/benchmark/run.rb
+++ /dev/null
@@ -1,127 +0,0 @@
-#
-# Ruby benchmark driver
-#
-
-require 'benchmark'
-require 'rbconfig'
-
-$matzrubyonly = false
-$rubyonly = false
-
-$results = []
-
-# prepare 'wc.input'
-def prepare_wc_input
- wcinput = File.join(File.dirname($0), 'wc.input')
- wcbase = File.join(File.dirname($0), 'wc.input.base')
- unless FileTest.exist?(wcinput)
- data = File.read(wcbase)
- 13.times{
- data << data
- }
- open(wcinput, 'w'){|f| f.write data}
- end
-end
-
-prepare_wc_input
-
-def bm file
- prog = File.readlines(file).map{|e| e.rstrip}.join("\n")
- return if prog.empty?
-
- /[a-z]+_(.+)\.rb/ =~ file
- bm_name = $1
- puts '-----------------------------------------------------------' unless $rubyonly || $matzrubyonly
- puts "#{bm_name}: "
-
-
-puts <<EOS unless $matzrubyonly || $rubyonly
-#{prog}
---
-EOS
- begin
- result = [bm_name]
- result << matzruby_exec(file) unless $rubyonly
- result << ruby_exec(file) unless $matzrubyonly
- $results << result
-
- rescue Exception => e
- puts
- puts "** benchmark failure: #{e}"
- puts e.backtrace
- end
-end
-
-def benchmark file, bin
- m = Benchmark.measure{
- `#{bin} #{$opts} #{file}`
- }
- sec = '%.3f' % m.real
- puts " #{sec}"
- sec
-end
-
-def ruby_exec file
- print 'ruby'
- benchmark file, $ruby_program
-end
-
-def matzruby_exec file
- print 'matz'
- rubylib = ENV['RUBYLIB']
- ENV['RUBYLIB'] = ''
- r = benchmark file, $matzruby_program
- ENV['RUBYLIB'] = rubylib
- r
-end
-
-if $0 == __FILE__
- ARGV.each{|arg|
- case arg
- when /\A--ruby=(.+)/
- $ruby_program = $1
- when /\A--matzruby=(.+)/
- $matzruby_program = $1
- when /\A--opts=(.+)/
- $opts = $1
- when /\A(-r|--only-ruby)\z/
- $rubyonly = true
- when /\A(-m|--only-matzruby)\z/
- $matzrubyonly = true
- end
- }
- ARGV.delete_if{|arg|
- /\A-/ =~ arg
- }
-
- puts "MatzRuby:"
- system("#{$matzruby_program} -v")
- puts "Ruby:"
- system("#{$ruby_program} -v")
- puts
-
- if ARGV.empty?
- Dir.glob(File.dirname(__FILE__) + '/bm_*.rb').sort.each{|file|
- bm file
- }
- else
- ARGV.each{|file|
- Dir.glob(File.join(File.dirname(__FILE__), file + '*')){|ef|
- # file = "#{File.dirname(__FILE__)}/#{file}.rb"
- bm ef
- }
- }
- end
-
- puts
- puts "-- benchmark summary ---------------------------"
- $results.each{|res|
- print res.shift, "\t"
- (res||[]).each{|result|
- /([\d\.]+)/ =~ result
- print $1 + "\t" if $1
- }
- puts
- }
-end
-
diff --git a/ruby_2_2/benchmark/runc.rb b/ruby_2_2/benchmark/runc.rb
deleted file mode 100644
index 97c5cef045..0000000000
--- a/ruby_2_2/benchmark/runc.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-#
-#
-
-require 'benchmark'
-require 'rbconfig'
-
-$rubybin = ENV['RUBY'] || RbConfig.ruby
-
-def runfile file
- puts file
- file = File.join(File.dirname($0), 'contrib', file)
- Benchmark.bm{|x|
- x.report('ruby'){
- system("#{$rubybin} #{file}")
- }
- x.report('yarv'){
- system("#{$rubybin} -rite -I.. #{file}")
- }
- }
-end
-
-ARGV.each{|file|
- runfile file
-}
-
-
diff --git a/ruby_2_2/benchmark/wc.input.base b/ruby_2_2/benchmark/wc.input.base
deleted file mode 100644
index 41143fbac0..0000000000
--- a/ruby_2_2/benchmark/wc.input.base
+++ /dev/null
@@ -1,25 +0,0 @@
-Subject: Re: Who was Izchak Miller?
-From: "Jane D. Anonymous" <nobody@yale.edu>
-Date: 1996/04/28
-Message-Id: <4lv7bc$oh@news.ycc.yale.edu>
-References: <317C405E.5DFA@panix.com> <4lk6vl$gde@ns.oar.net>
-To: 75176.2330@compuserve.com
-Content-Type: text/plain; charset=us-ascii
-Organization: Yale University
-X-Url: news:4lk6vl$gde@ns.oar.net
-Mime-Version: 1.0
-Newsgroups: rec.games.roguelike.nethack
-X-Mailer: Mozilla 1.1N (Macintosh; I; 68K)
-
-Hello there, Izchak Miller was my father. When I was younger I spent
-many a night, hunched over the keyboard with a cup of tea, playing
-nethack with him and my brother. my dad was a philosopher with a strong
-weakness for fantasy/sci fi. I remember when he started to get involved
-with the Nethack team- my brother's Dungeons and Dragons monster book
-found a regular place beside my dad's desk. it's nice to see him living
-on in the game he loved so much :-).
- Tamar Miller
-
-The following is a really long word of 5000 characters:
-
-wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww