Created
September 11, 2012 18:39
-
-
Save pirj/3700703 to your computer and use it in GitHub Desktop.
Eventmachine & Delorean time travel thing
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 'em/pure_ruby' | |
require 'eventmachine' | |
require 'delorean' | |
require 'benchmark' | |
Benchmark.measure do | |
EM.run do | |
ticks = 0 | |
timer = EM.add_periodic_timer 10 do | |
print '.' | |
ticks = ticks + 1 | |
timer.cancel if ticks > 50 | |
EM.stop if ticks > 50 | |
EM.next_tick do | |
Delorean.jump 10 | |
end | |
end | |
Delorean.jump 10 | |
end | |
end | |
................................................... => 0.060000 0.010000 0.070000 (510.166286) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Delorean works fine with pure Ruby Eventmachine implementation only.