Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Test of double vs single quotes with escaped tabs vs embedded tabs

View quotes_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.