Sha256: 6ebae4d7322be853a9026b5410a3dde4decf019f7bbfe893ded45dbdbefe5d2e

Contents?: true

Size: 323 Bytes

Versions: 14

Compression:

Stored size: 323 Bytes

Contents

require 'lightio'

start = Time.now

beams = 1000.times.map do
  # LightIO::Beam is a thread-like executor, use it instead Thread
  LightIO::Beam.new do
    # do some io operations in beam
    LightIO.sleep(1)
  end
end

beams.each(&:join)
seconds = Time.now - start
puts "1000 beams take #{seconds - 1} seconds to create"

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
lightio-0.4.4 examples/beams.rb
lightio-0.4.3 examples/beams.rb
lightio-0.4.2 examples/beams.rb
lightio-0.4.1 examples/beams.rb
lightio-0.4.0 examples/beams.rb
lightio-0.4.0.pre examples/beams.rb
lightio-0.3.2 examples/beams.rb
lightio-0.3.1 examples/beams.rb
lightio-0.3.0 examples/beams.rb
lightio-0.2.2 examples/beams.rb
lightio-0.2.1 examples/beams.rb
lightio-0.2.0 examples/beams.rb
lightio-0.1.1 examples/beams.rb
lightio-0.1.0 examples/beams.rb