benchmarks/actor.rb in celluloid-io-0.17.1 vs benchmarks/actor.rb in celluloid-io-0.17.2

- old
+ new

@@ -3,11 +3,12 @@ require 'rubygems' require 'bundler/setup' require 'celluloid/io' require 'benchmark/ips' -class ExampleActor +#de TODO: Consolidate with Celluloid benchmarking actor. +class BenchmarkingActor include Celluloid::IO def initialize @condition = Celluloid::Condition.new end @@ -21,11 +22,11 @@ def wait_until_finished @condition.wait end end -example_actor = ExampleActor.new +example_actor = BenchmarkingActor.new mailbox = Celluloid::IO::Mailbox.new latch_in, latch_out = Queue.new, Queue.new latch = Thread.new do while true @@ -34,10 +35,10 @@ latch_out << :done end end Benchmark.ips do |ips| - ips.report("spawn") { ExampleActor.new.terminate } + ips.report("spawn") { BenchmarkingActor.new.terminate } ips.report("calls") { example_actor.example_method } ips.report("async calls") do |n| waiter = example_actor.future.wait_until_finished