Skip to content

Instantly share code, notes, and snippets.

@pirj
Created September 11, 2012 18:39
Show Gist options
  • Save pirj/3700703 to your computer and use it in GitHub Desktop.
Save pirj/3700703 to your computer and use it in GitHub Desktop.
Eventmachine & Delorean time travel thing
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)
@pirj
Copy link
Author

pirj commented Sep 12, 2012

Delorean works fine with pure Ruby Eventmachine implementation only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment