Last active
December 21, 2020 19:43
-
-
Save alterisian/092f1fd19a8e2464453b96172b64d9f4 to your computer and use it in GitHub Desktop.
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
# 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 |
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
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.