Skip to content

Instantly share code, notes, and snippets.

@gpherguson
Created February 14, 2013 23:49

Revisions

  1. gpherguson created this gist Feb 14, 2013.
    19 changes: 19 additions & 0 deletions quotes_test.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    require 'benchmark'

    n = 10_000_000

    Benchmark.bm(24) do |b|
    5.times do
    b.report('double-quotes with \t') { n.times { "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" } }
    b.report('double-quotes with <tab>') { n.times { " " } }
    b.report('single-quotes with <tab>') { n.times { ' ' } }
    end
    end

    5.times do
    Benchmark.bm(24) do |b|
    b.report('double-quotes with \t') { n.times { "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" } }
    b.report('double-quotes with <tab>') { n.times { " " } }
    b.report('single-quotes with <tab>') { n.times { ' ' } }
    end
    end