puts <<-HEAD YARV Benchmark Ruby 1.9 before / with YARV (in seconds) HEAD WIDTH_FACTOR = 50 DATA.read.scan(/^(\w+)\s+(\S+)\s+(\S+)\s+(broken)?/) do |name, old, new, broken| if broken puts "" puts "" % [name] + "" * 3 puts "" next end old = old.to_f new = new.to_f puts "" puts '' % name puts '' % [old, new] puts '' % [WIDTH_FACTOR * (old / new), (new <= old ? 'faster' : 'slower'), old / new] puts "" end puts <<-BODY
Benchmark old new
%s
%s%0.1f%0.1f
%0.1fx
BODY __END__ app_answer 0.702 0.134 app_factorial 0.039 0.981 broken app_fib 8.264 1.862 app_mandelbrot 2.538 1.632 app_pentomino 110.740 0.105 broken app_raise 3.354 4.344 app_strconcat 1.471 1.219 app_tak 11.023 2.502 app_tarai 8.680 1.990 loop_times 5.176 4.313 loop_whileloop 11.746 1.921 loop_whileloop2 2.364 0.402 so_ackermann 11.634 1.933 so_array 7.571 3.961 so_concatenate 2.174 1.311 so_count_words 0.572 0.608 so_exception 5.071 5.505 so_lists 1.243 0.891 so_matrix 2.374 1.152 so_nested_loop 5.985 3.529 so_object 7.628 7.782 so_random 2.359 0.875 so_sieve 0.827 0.209 vm1_block 26.461 6.260 vm1_const 18.407 2.932 vm1_ensure 13.270 1.934 vm1_length 21.601 3.685 vm1_rescue 14.478 2.142 vm1_simplereturn 19.263 4.609 vm1_swap 31.430 2.688 vm2_array 9.444 3.655 vm2_method 12.927 4.845 vm2_poly_method 17.925 6.303 vm2_poly_method_ov 5.045 0.901 vm2_proc 8.247 2.170 vm2_regexp 5.623 3.574 vm2_send 7.225 4.371 vm2_super 5.552 1.536 vm2_unif1 4.485 1.060 vm2_zsuper 6.333 1.629 vm3_thread_ 0.025 0.276 broken