Skip to content

Instantly share code, notes, and snippets.

@jmettraux

jmettraux/t.rb Secret

Last active December 24, 2015 05:19
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 jmettraux/b3f2bacb2a59627aea00 to your computer and use it in GitHub Desktop.
Save jmettraux/b3f2bacb2a59627aea00 to your computer and use it in GitHub Desktop.
require 'rufus-scheduler'
p [ RUBY_VERSION, RUBY_PLATFORM ]
s = Rufus::Scheduler.new
t0 = Time.now
total = 38_000
(total * 0.9).to_i.times do
s.every('1h') {}
end
(total * 0.1).to_i.times do
s.cron('* * * * *') {}
end
p Time.now - t0
# results on my OSX laptop:
#
# $ chruby
# jruby-1.7.22
# ruby-1.8.7-p374
# ruby-1.9.3-p547
# ruby-2.1.3
#
# $ chruby jruby
# $ bundle exec ruby t.rb
# ["1.9.3", "java"]
# 16.403
#
# $ chruby 1.9
# $ bundle exec ruby t.rb
# ["1.9.3", "x86_64-darwin14.5.0"]
# 37.218007
#
# $ chruby 2.1
# $ bundle exec ruby t.rb
# ["2.1.3", "x86_64-darwin14.0"]
# 13.670538
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment