Skip to content

Instantly share code, notes, and snippets.

@alterisian
Last active December 21, 2020 19:43
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 alterisian/092f1fd19a8e2464453b96172b64d9f4 to your computer and use it in GitHub Desktop.
Save alterisian/092f1fd19a8e2464453b96172b64d9f4 to your computer and use it in GitHub Desktop.
# A probably flawed benchmark. Interested in your 2.6.3 vs TruffleRuby vs 3.0 times though :)
# Usage: open irb. paste in the below function.
def press
puts "Ruby version: #{RUBY_VERSION}, patchlevel: #{RUBY_PATCHLEVEL}, platform: #{RUBY_PLATFORM}, release date: #{RUBY_RELEASE_DATE}"
count=0
start = Time.now
(1..10000).each { |value| count=count+value }; puts count
finish = Time.now
(finish - start)
end
#Ian output (2.6.3) Thinkpad x1 carbon ubuntu 20
# 0.000419629
# 0.000437511
# 0.000416412
@alterisian
Copy link
Author

Found this stackoverflow useful for determining the version you're running in code: https://stackoverflow.com/questions/1589751/determine-ruby-version-from-within-rails
Thought it would be useful for recording the output.

@alterisian
Copy link
Author

Ruby version: 3.0.0, patchlevel: -1, platform: x86_64-linux, release date: 2020-12-20

0.00186655

0.00140321

0.00245121

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