Skip to content

Instantly share code, notes, and snippets.

@fbernier
Last active December 15, 2015 20:40

Revisions

  1. fbernier revised this gist Apr 5, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    require "benchmark/ips"

    Benchmark.ips do |x|
    x.report("doublequote assignment:") {a = "yo man"}
    x.report("double quote assignment:") {a = "yo man"}
    x.report("double quote +:") {|i| a = "yo man" + i.to_s}
    x.report("double quote <<:") {|i| a = "yo man" << i.to_s}
    x.report("double quote interpolation:") {|i| a = "yo man #{i}"}
  2. fbernier created this gist Apr 5, 2013.
    12 changes: 12 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    require "benchmark/ips"

    Benchmark.ips do |x|
    x.report("doublequote assignment:") {a = "yo man"}
    x.report("double quote +:") {|i| a = "yo man" + i.to_s}
    x.report("double quote <<:") {|i| a = "yo man" << i.to_s}
    x.report("double quote interpolation:") {|i| a = "yo man #{i}"}

    x.report("single quote assignment:") {a = 'yo man'}
    x.report("single quote +:") {|i| a = 'yo man' + i.to_s}
    x.report("single quote <<:") {|i| a = 'yo man' << i.to_s}
    end