Sha256: 03a8d90042217b392119552ac5460ce41a44c6dba83d64b97fc67443ebc95691
Contents?: true
Size: 796 Bytes
Versions: 25
Compression:
Stored size: 796 Bytes
Contents
# frozen_string_literal: true require 'dynflow' require 'benchmark' class Receiver def initialize(limit, future) @limit = limit @future = future @counter = 0 end def null @counter += 1 @future.fulfill(true) if @counter >= @limit end end def test_case(count) future = Concurrent::Promises.resolvable_future clock = Dynflow::Clock.spawn(:name => 'clock') receiver = Receiver.new(count, future) count.times do clock.ping(receiver, 0, nil, :null) end future.wait end Benchmark.bm do |bm| bm.report(' 100') { test_case 100 } bm.report(' 1000') { test_case 1_000 } bm.report(' 5000') { test_case 5_000 } bm.report(' 10000') { test_case 10_000 } bm.report(' 50000') { test_case 50_000 } bm.report('100000') { test_case 100_000 } end
Version data entries
25 entries across 25 versions & 1 rubygems