Sha256: 192a5e1a332503591a83bc7c325c0102039ef92d33a7c12544beb7e88d5f6c9f

Contents?: true

Size: 595 Bytes

Versions: 11

Compression:

Stored size: 595 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony'

def bm(fibers, iterations)
  count = 0
  t_pre = Time.now
  fibers.times do
    spin do
      iterations.times do
        snooze
        count += 1
      end
    end
  end
  t0 = Time.now
  Fiber.current.await_all_children
  dt = Time.now - t0
  puts "#{[fibers, iterations].inspect} setup: #{t0 - t_pre}s count: #{count} #{count / dt.to_f}/s"
  Thread.current.run_queue_trace
end

GC.disable

bm(1, 1_000_000)
bm(10, 100_000)
bm(100, 10_000)
bm(1_000, 1_000)
bm(10_000, 100)

# bm(100_000,    10)
# bm(1_000_000,   1)

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
polyphony-0.45.4 examples/performance/multi_snooze.rb
polyphony-0.45.2 examples/performance/multi_snooze.rb
polyphony-0.45.1 examples/performance/multi_snooze.rb
polyphony-0.45.0 examples/performance/multi_snooze.rb
polyphony-0.44.0 examples/performance/multi_snooze.rb
polyphony-0.43.11 examples/performance/multi_snooze.rb
polyphony-0.43.10 examples/performance/multi_snooze.rb
polyphony-0.43.9 examples/performance/multi_snooze.rb
polyphony-0.43.8 examples/performance/multi_snooze.rb
polyphony-0.43.6 examples/performance/multi_snooze.rb
polyphony-0.43.5 examples/performance/multi_snooze.rb