Skip to content

Instantly share code, notes, and snippets.

@jsanders
Created March 21, 2012 17:09
Show Gist options
  • Save jsanders/2149607 to your computer and use it in GitHub Desktop.
Save jsanders/2149607 to your computer and use it in GitHub Desktop.
String building benchmark
[11:00] ~ $ ruby str_benchmark.rb
user system total real
interp 1.370000 2.020000 3.390000 ( 3.392649)
arrayjoin 0.030000 0.000000 0.030000 ( 0.029942)
concat 0.020000 0.000000 0.020000 ( 0.023137)
plusequals 1.560000 0.720000 2.280000 ( 2.269754)
user system total real
concat 0.020000 0.000000 0.020000 ( 0.020088)
interp 1.780000 2.090000 3.870000 ( 3.870043)
arrayjoin 0.020000 0.000000 0.020000 ( 0.021839)
plusequals 1.560000 0.720000 2.280000 ( 2.283599)
user system total real
interp 1.780000 2.070000 3.850000 ( 3.849193)
plusequals 1.560000 0.720000 2.280000 ( 2.280609)
arrayjoin 0.030000 0.000000 0.030000 ( 0.027500)
concat 0.020000 0.000000 0.020000 ( 0.022622)
user system total real
plusequals 1.550000 0.710000 2.260000 ( 2.258864)
interp 1.780000 2.080000 3.860000 ( 3.856518)
arrayjoin 0.020000 0.000000 0.020000 ( 0.021609)
concat 0.020000 0.000000 0.020000 ( 0.024198)
user system total real
interp 1.780000 2.090000 3.870000 ( 3.866496)
concat 0.020000 0.000000 0.020000 ( 0.020284)
plusequals 1.550000 0.710000 2.260000 ( 2.261218)
arrayjoin 0.020000 0.000000 0.020000 ( 0.022119)
user system total real
interp 1.550000 2.050000 3.600000 ( 3.593089)
arrayjoin 0.020000 0.000000 0.020000 ( 0.028395)
plusequals 1.670000 0.720000 2.390000 ( 2.386022)
concat 0.030000 0.000000 0.030000 ( 0.020229)
user system total real
plusequals 1.680000 0.720000 2.400000 ( 2.401653)
interp 1.990000 2.130000 4.120000 ( 4.128949)
concat 0.020000 0.000000 0.020000 ( 0.025362)
arrayjoin 0.030000 0.000000 0.030000 ( 0.023183)
user system total real
plusequals 1.400000 0.710000 2.110000 ( 2.117299)
arrayjoin 0.030000 0.010000 0.040000 ( 0.029539)
interp 2.260000 2.090000 4.350000 ( 4.351215)
concat 0.020000 0.000000 0.020000 ( 0.020326)
user system total real
plusequals 1.870000 0.710000 2.580000 ( 2.584757)
interp 2.260000 2.090000 4.350000 ( 4.341767)
concat 0.020000 0.000000 0.020000 ( 0.020366)
arrayjoin 0.020000 0.000000 0.020000 ( 0.023609)
user system total real
arrayjoin 0.030000 0.000000 0.030000 ( 0.031307)
concat 0.030000 0.000000 0.030000 ( 0.027805)
interp 2.280000 2.090000 4.370000 ( 4.376301)
plusequals 1.880000 0.710000 2.590000 ( 2.594184)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment