Igor Alexandrov

Programming and something else…

Yet Another Ruby Shootout (Round 2)

| Comments

One week ago ruby-2.0.0-rc2 has been released, so I decided that the time has come to benchmark it again. This release will be compared to ruby-2.0.0-preview1 that I used in my first shooutout and to ruby-1.9.3-p385 that also was tagged not so long ago.

This is my configuration for today:

  • OS: OSX 10.8.2
  • CPU: 2.2GHz i7
  • RAM: 8Gb 1333 MHz DDR3 (yes, I added another 8Gb of RAM)
  • HHD: Seagate Momentus XT, 2.5”, SATA 3Gb/s, 7200 rpm, hybrid

Installation

As in previous shooutout, I used head RVM to compile rubies.

1
  saturn:~$ rvm get head

Then I installed ruby-1.9.3-p385 with:

1
  saturn:~$ rvm install ruby-1.9.3-p385

And again with clang I installed ruby-2.0.0-rc2 and reinstalled ruby-2.0.0-preview1:

1
2
3
4
  saturn:~$ export CC=clang
  saturn:~$ rvm install ruby-2.0.0-rc2
  ...
  saturn:~$ rvm reinstall ruby-2.0.0-preview1

Benchmark

Benchmark FileInput Sizeruby-2.0.0-rc2ruby-2.0.0-preview1%ruby-1.9.3-p385%
macro-benchmarks/bm_gzip.rb1005.8981395.926785-0.49%5.7932951.78%
macro-benchmarks/bm_hilbert_matrix.rb100.0022480.002446-8.81%0.002263-0.67%
macro-benchmarks/bm_hilbert_matrix.rb200.0314490.0297815.3%0.0293936.54%
macro-benchmarks/bm_hilbert_matrix.rb300.1587970.1459888.07%0.1431199.87%
macro-benchmarks/bm_hilbert_matrix.rb400.5690170.48441614.87%0.46427918.41%
macro-benchmarks/bm_hilbert_matrix.rb501.129761.0781844.57%1.0284128.97%
macro-benchmarks/bm_hilbert_matrix.rb602.6133712.660835-1.82%2.3894568.57%
macro-benchmarks/bm_mpart.rb3000.254750.2333098.42%0.274421-7.72%
macro-benchmarks/bm_norvig_spelling.rb504.8727535.0403-3.44%4.6898973.75%
macro-benchmarks/bm_parse_log.rb1000.6749230.6698620.75%0.52139122.75%
macro-benchmarks/bm_rcs.rb1000.2204570.2114564.08%0.32246-46.27%
macro-benchmarks/bm_sudoku.rb11.9301031.63164115.46%1.73104710.31%
micro-benchmarks/bm_app_factorial.rb50000.0158860.01652-3.99%0.016427-3.41%
micro-benchmarks/bm_app_fib.rb300.1850380.197736-6.86%0.196805-6.36%
micro-benchmarks/bm_app_fib.rb352.0920912.164146-3.44%2.168275-3.64%
micro-benchmarks/bm_app_mandelbrot.rb10.2088270.2025822.99%0.271782-30.15%
micro-benchmarks/bm_app_pentomino.rb127.04830324.8451418.15%25.5815935.42%
micro-benchmarks/bm_app_tak.rb70.181920.14408720.8%0.15722913.57%
micro-benchmarks/bm_app_tak.rb80.5249280.39590424.58%0.45048514.18%
micro-benchmarks/bm_app_tak.rb91.3931791.08512422.11%1.18677914.82%
micro-benchmarks/bm_app_tarai.rb30.635140.49486222.09%0.54455514.26%
micro-benchmarks/bm_app_tarai.rb40.7712430.59261823.16%0.65883414.58%
micro-benchmarks/bm_app_tarai.rb50.9295780.7177822.78%0.78298215.77%
micro-benchmarks/bm_binary_trees.rb110.6526110.1554574.67%10.3621072.73%
micro-benchmarks/bm_cal.rb5000.0568340.04764316.17%0.0531046.56%
micro-benchmarks/bm_count_multithreaded.rb10.005680.00498112.31%0.005845-2.9%
micro-benchmarks/bm_count_multithreaded.rb20.0114090.00975214.52%0.011731-2.82%
micro-benchmarks/bm_count_multithreaded.rb40.0230.01954615.02%0.02347-2.04%
micro-benchmarks/bm_count_multithreaded.rb80.0445890.03869213.23%0.048141-7.97%
micro-benchmarks/bm_count_multithreaded.rb160.0906040.07895112.86%0.09512-4.98%
micro-benchmarks/bm_count_shared_thread.rb10.0580580.04759118.03%0.057670.67%
micro-benchmarks/bm_count_shared_thread.rb20.0569780.0486614.6%0.057271-0.51%
micro-benchmarks/bm_count_shared_thread.rb40.0577640.04947314.35%0.057370.68%
micro-benchmarks/bm_count_shared_thread.rb80.0577080.05052412.45%0.058656-1.64%
micro-benchmarks/bm_count_shared_thread.rb160.0591130.04973715.86%0.059617-0.85%
micro-benchmarks/bm_dirp.rb100001.6202791.674995-3.38%1.5883811.97%
micro-benchmarks/bm_eval.rb10000007.5929457.2759764.17%6.56542413.53%
micro-benchmarks/bm_fannkuch.rb60.002020.002074-2.67%0.002154-6.63%
micro-benchmarks/bm_fannkuch.rb80.148730.1460331.81%0.157371-5.81%
micro-benchmarks/bm_fannkuch.rb1019.34919518.7886842.9%20.627816-6.61%
micro-benchmarks/bm_fasta.rb100000010.1719999.8120583.54%10.562423-3.84%
micro-benchmarks/bm_fiber_ring.rb100.0002540.0002415.12%0.00022212.6%
micro-benchmarks/bm_fiber_ring.rb1000.0142810.01141120.1%0.01263711.51%
micro-benchmarks/bm_fiber_ring.rb10001.6073821.31313918.31%1.35169515.91%
micro-benchmarks/bm_fractal.rb50.6735810.6481933.77%1.313758-95.04%
micro-benchmarks/bm_gc_array.rb136.01752337.251238-3.43%36.009490.02%
micro-benchmarks/bm_gc_mb.rb5000000.1386010.15435-11.36%0.144698-4.4%
micro-benchmarks/bm_gc_mb.rb10000000.2954360.2720867.9%0.26342910.83%
micro-benchmarks/bm_gc_mb.rb30000000.7325190.924174-26.16%0.890278-21.54%
micro-benchmarks/bm_gc_string.rb13.1184313.139099-0.66%3.0904320.9%
micro-benchmarks/bm_knucleotide.rb10.6580460.6272074.69%0.6580460.0%
micro-benchmarks/bm_list.rb10000.0221740.0203418.27%0.022238-0.29%
micro-benchmarks/bm_list.rb100001.7043851.731841-1.61%1.700340.24%
micro-benchmarks/bm_lucas_lehmer.rb96893.3556143.3537240.06%3.431578-2.26%
micro-benchmarks/bm_lucas_lehmer.rb99413.6135483.6092350.12%3.652255-1.07%
micro-benchmarks/bm_lucas_lehmer.rb112135.0636055.131472-1.34%5.09221-0.56%
micro-benchmarks/bm_lucas_lehmer.rb1993727.58316527.666417-0.3%27.726571-0.52%
micro-benchmarks/bm_mandelbrot.rb19.1346697.94025213.08%15.295332-67.44%
micro-benchmarks/bm_mbari_bogus1.rb10.0183660.018712-1.88%0.025003-36.14%
micro-benchmarks/bm_mergesort.rb10.5906780.678744-14.91%0.665291-12.63%
micro-benchmarks/bm_mergesort_hongli.rb30000.8533380.8116344.89%1.056501-23.81%
micro-benchmarks/bm_meteor_contest.rb15.1187164.9323173.64%5.504683-7.54%
micro-benchmarks/bm_monte_carlo_pi.rb100000003.0765122.8850726.22%5.228851-69.96%
micro-benchmarks/bm_nbody.rb1000001.1055881.124018-1.67%2.752928-149.0%
micro-benchmarks/bm_nsieve.rb92.7822042.658074.46%3.160727-13.61%
micro-benchmarks/bm_nsieve_bits.rb8SignalException1.6394332.026382
micro-benchmarks/bm_observ.rb1000000.3185410.2967536.84%0.44738-40.45%
micro-benchmarks/bm_open_many_files.rb500000.5117620.5090350.53%0.4806736.07%
micro-benchmarks/bm_partial_sums.rb25000002.7278782.6232843.83%6.043416-121.54%
micro-benchmarks/bm_pathname.rb10055.65025753.1032154.58%54.095242.79%
micro-benchmarks/bm_pi.rb10000.0239720.02141210.68%0.024194-0.93%
micro-benchmarks/bm_pi.rb100001.1395241.122911.46%1.168089-2.51%
micro-benchmarks/bm_primes.rb30000.0113740.0102419.96%0.01197-5.24%
micro-benchmarks/bm_primes.rb300000.1191170.10606710.96%0.126013-5.79%
micro-benchmarks/bm_primes.rb3000001.5578741.39296310.59%1.637907-5.14%
micro-benchmarks/bm_quicksort.rb11.3263491.1886210.38%1.342677-1.23%
micro-benchmarks/bm_read_large.rb1002.0451111.78326412.8%1.80075511.95%
micro-benchmarks/bm_regex_dna.rb202.482292.3874133.82%3.087872-24.4%
micro-benchmarks/bm_reverse_compliment.rb14.4666914.2649834.52%3.85846413.62%
micro-benchmarks/bm_simple_connect.rb10.0002130.00026.1%0.000238-11.74%
micro-benchmarks/bm_simple_connect.rb1000.0097280.00852812.34%0.00862911.3%
micro-benchmarks/bm_simple_connect.rb5000.05780.0571071.2%0.0554384.09%
micro-benchmarks/bm_simple_server.rb10.0004970.0004842.62%0.000777-56.34%
micro-benchmarks/bm_simple_server.rb1000.0019240.002101-9.2%0.002361-22.71%
micro-benchmarks/bm_simple_server.rb1000001.508621.3954237.5%1.4452794.2%
micro-benchmarks/bm_so_ackermann.rb70.0604860.0595521.54%0.0601720.52%
micro-benchmarks/bm_so_ackermann.rb90.9869110.9549383.24%0.9713331.58%
micro-benchmarks/bm_so_array.rb90001.5695831.4196229.55%2.009882-28.05%
micro-benchmarks/bm_so_count_words.rb1002.7822912.80988-0.99%2.6106626.17%
micro-benchmarks/bm_so_exception.rb5000001.1260381.0409267.56%7.8969-601.3%
micro-benchmarks/bm_so_lists.rb10003.1804524.844191-52.31%4.389144-38.0%
micro-benchmarks/bm_so_lists_small.rb10000.637031.203322-88.9%0.91059-42.94%
micro-benchmarks/bm_so_matrix.rb600.434610.3806112.42%0.519043-19.43%
micro-benchmarks/bm_so_object.rb5000000.4079280.3734568.45%0.441667-8.27%
micro-benchmarks/bm_so_object.rb10000000.8134360.7536877.35%0.888771-9.26%
micro-benchmarks/bm_so_object.rb15000001.2241051.1272787.91%1.321836-7.98%
micro-benchmarks/bm_so_sieve.rb40007.6354867.4820652.01%8.900976-16.57%
micro-benchmarks/bm_socket_transfer_1mb.rb100000.6294410.6064393.65%0.5909746.11%
micro-benchmarks/bm_socket_transfer_1mb.rb10000000.6140510.634619-3.35%0.5969682.78%
micro-benchmarks/bm_socket_transfer_1mb_noblock.rb100000.5399650.5307181.71%0.532921.3%
micro-benchmarks/bm_socket_transfer_1mb_noblock.rb10000000.5393070.5348830.82%0.5339490.99%
micro-benchmarks/bm_spectral_norm.rb1000.118510.1104276.82%0.166705-40.67%
micro-benchmarks/bm_string_concat.rb100000001.6221691.4858098.41%1.5217026.19%
micro-benchmarks/bm_sum_file.rb1003.1148272.8768317.64%2.9962093.81%
micro-benchmarks/bm_word_anagrams.rb12.8655812.811971.87%2.973522-3.77%
micro-benchmarks/bm_write_large.rb1000.5882670.5803671.34%0.599393-1.89%
rdoc/bm_rdoc_against_itself_darkfish.rb1SystemExit8.7531915.413807
rdoc/bm_rdoc_against_itself_ri.rb1SystemExitSystemExit5.334588


As you can see, I cannot say that ruby-2.0.0-rc2 is absolutely faster then ruby-2.0.0-preview1 or ruby-1.9.3-p385. Here are best results for ruby-2.0.0-rc2:

  • macro-benchmarks/bm_hilbert_matrix.rb
  • micro-benchmarks/bm_app_fib.rb
  • micro-benchmarks/bm_app_mandelbrot.rb
  • micro-benchmarks/bm_gc_mb.rb
  • micro-benchmarks/bm_mergesort.rb
  • micro-benchmarks/bm_so_lists.rb
  • micro-benchmarks/bm_so_lists_small.rb

One detail connects all these test, they all are about arrays! Initialization, dupping, pushing, popping, reversing – are faster in RC2.

I don’t know why, but multithreading in RC2 works slower then in preview1, but a bit faster or close to 1.9.3. Network tests are also slower in RC2.

If you want to see results of any other tests – write me, I will try to include them in future shootouts.

Comments