File: concat_vs_interpolate.rb

package info (click to toggle)
ruby-excon 0.112.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,232 kB
  • sloc: ruby: 7,855; makefile: 5
file content (22 lines) | stat: -rw-r--r-- 442 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'rubygems'
require 'tach'

key = 'Content-Length'
value = '100'
Tach.meter(1_000) do
  tach('concat') do
    temp = ''
    temp << key << ': ' << value << "\r\n"
  end
  tach('interpolate') do
    "#{key}: #{value}\r\n"
  end
end

# +-------------+----------+
# | tach        | total    |
# +-------------+----------+
# | interpolate | 0.000404 |
# +-------------+----------+
# | concat      | 0.000564 |
# +-------------+----------+