Created
November 8, 2012 04:49
-
-
Save mark-burnett/4036852 to your computer and use it in GitHub Desktop.
Ruote iterator benchmarks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'ruote' | |
$start_time = nil | |
$stop_time = nil | |
class StartTime | |
include Ruote::LocalParticipant | |
def on_workitem | |
# p workitem | |
$start_time = Time.now | |
reply | |
end | |
end | |
class StopTime | |
include Ruote::LocalParticipant | |
def on_workitem | |
# p workitem | |
$stop_time = Time.now | |
reply | |
end | |
end | |
engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new)) | |
engine.register_participant 'nothing', Ruote::NoOpParticipant | |
engine.register_participant 'start_time', StartTime | |
engine.register_participant 'stop_time', StopTime | |
#engine.noisy = true | |
(1..10).each do |count| | |
itimes = 1000 * count | |
pdef = Ruote.define do | |
start_time | |
# concurrent_iterator :times => itimes do | |
iterator :times itimes do | |
nothing | |
end | |
stop_time | |
end | |
wfid = engine.launch(pdef) | |
engine.wait_for(wfid, {:timeout => 6000}) | |
runtime = $stop_time - $start_time | |
puts "#{itimes} #{runtime}" | |
end |
Times for concurrent_iterator (on a mac book pro):
1000 118.164302
2000 499.569966
3000 1137.420586
4000 2038.072399
5000 > 6000
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Times for iterator (on a mac book pro):
1000 11.398305
2000 24.438523
3000 42.574891
4000 69.786117
5000 107.863855
6000 99.070605
7000 143.691974
8000 215.467038
9000 320.45493
10000 400.215683