Skip to content

Instantly share code, notes, and snippets.

@alterisian
Last active December 21, 2020 19:43
Show Gist options
  • Select an option

  • Save alterisian/092f1fd19a8e2464453b96172b64d9f4 to your computer and use it in GitHub Desktop.

Select an option

Save alterisian/092f1fd19a8e2464453b96172b64d9f4 to your computer and use it in GitHub Desktop.

Revisions

  1. alterisian revised this gist Dec 21, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions rb_bench_press.rb
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    # 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
  2. alterisian created this gist Dec 21, 2020.
    15 changes: 15 additions & 0 deletions rb_bench_press.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # 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
    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