Sha256: 50298dc09868c9fa083e228194764889af0918dff67b44483395cd8c5c40d92b

Contents?: true

Size: 346 Bytes

Versions: 4

Compression:

Stored size: 346 Bytes

Contents

# for example, this takes only 4 seconds or so to complete (8 iterations
# running in two processes = twice as fast)
#

  require 'forkoff'

  a = Time.now.to_f

  results =
    (0..7).forkoff do |i|
      sleep 1
      i ** 2
    end

  b = Time.now.to_f

  elapsed = b - a

  puts "elapsed: #{ elapsed }"
  puts "results: #{ results.inspect }"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
forkoff-1.2.0 samples/b.rb
forkoff-1.1.1 samples/b.rb
forkoff-1.1.0 samples/b.rb
forkoff-0.0.4 samples/b.rb