Skip to content

Instantly share code, notes, and snippets.

@tarcieri
Created December 31, 2011 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarcieri/1542400 to your computer and use it in GitHub Desktop.
Save tarcieri/1542400 to your computer and use it in GitHub Desktop.
# Comment this out on JRuby 1.6.5 and the example will "work" long enough to break
# require 'fiber' is broken on JRuby 1.6.5
require 'fiber'
started_at = Time.now
100000.times do |n|
if n % 1000 == 0
time = Time.now
puts "#{n} fibers (#{"%0.3f" % (time - started_at)} seconds)"
started_at = time
end
Fiber.new { }.resume
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment