Sha256: c6585e04b4af92753416eddc96223016b4505cd078265ad9c8bf00118219a84f

Contents?: true

Size: 455 Bytes

Versions: 46

Compression:

Stored size: 455 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony'

M = 100
N = 10000

GC.disable

def monotonic_clock
  ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
end

def spin_proc(next_fiber)
  spin_loop { next_fiber << receive }
end

last = Fiber.current
N.times { last = spin_proc(last) }

snooze
t0 = monotonic_clock
M.times do
  last << 'hello'
  receive
end
elapsed = monotonic_clock - t0
puts "M=#{M} N=#{N} elapsed: #{elapsed}"

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
polyphony-1.6 examples/core/ring.rb
polyphony-1.5 examples/core/ring.rb
polyphony-1.4 examples/core/ring.rb
polyphony-1.3 examples/core/ring.rb
polyphony-1.2.1 examples/core/ring.rb
polyphony-1.2 examples/core/ring.rb
polyphony-1.1.1 examples/core/ring.rb
polyphony-1.1 examples/core/ring.rb
polyphony-1.0.2 examples/core/ring.rb
polyphony-1.0.1 examples/core/ring.rb
polyphony-1.0 examples/core/ring.rb
polyphony-0.99.6 examples/core/ring.rb
polyphony-0.99.5 examples/core/ring.rb
polyphony-0.99.4 examples/core/ring.rb
polyphony-0.99.3 examples/core/ring.rb
polyphony-0.99.2 examples/core/ring.rb
polyphony-0.99.1 examples/core/ring.rb
polyphony-0.99 examples/core/ring.rb
polyphony-0.98 examples/core/ring.rb
polyphony-0.97 examples/core/ring.rb