/mobile Handheld Friendly website

 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,00018.4213.6615,596215  37% 6% 24% 54%
5,000,000184.18138.4815,596215  42% 14% 16% 45%
50,000,0001,750.401,259.4015,584215  33% 25% 26% 35%

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) [i686-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

Wed, 08 Jan 2014 21:23:08 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