performance measurements

Each table row shows performance measurements for this Ruby program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
500,00017.1812.4719,912215  51% 45% 4% 24%
5,000,000169.91121.6319,908215  15% 23% 45% 40%
50,000,0001,696.351,183.5719,908215  31% 29% 31% 31%

Read the ↓ make, command line, and program output logs to see how this program was run.

Read thread-ring benchmark to see what this program should do.

 notes

ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]

 thread-ring Ruby #2 program source code

# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org
#
# contributed by Serhiy Boiko


#require 'thread'
THREAD_NUM = 503
number = ARGV.first.to_i

threads = []
for i in 1..THREAD_NUM
   threads << Thread.new(i) do |thr_num|
      while true
         Thread.stop
         if number > 0
            number -= 1
         else
            puts thr_num
            exit 0
         end
      end
   end
end

prev_thread = threads.last
while true
   for thread in threads
      Thread.pass until prev_thread.stop?
      thread.run
      prev_thread = thread
   end
end

 make, command-line, and program output logs

Thu, 09 Jan 2014 05:13:53 GMT

COMMAND LINE:
/usr/local/src/ruby-2.1.0/ruby threadring.yarv-2.yarv 50000000

PROGRAM OUTPUT:
292

Revised BSD license

  Home   Conclusions   License   Play