4
# data = "Content-Length: 100\r\n"
5
# Benchmark.bmbm(25) do |bench|
6
# bench.report('chomp') do
8
# data = "Content-Length: 100\r\n"
12
# bench.report('chomp!') do
14
# data = "Content-Length: 100\r\n"
18
# bench.report('chop') do
20
# data = "Content-Length: 100\r\n"
24
# bench.report('chop!') do
26
# data = "Content-Length: 100\r\n"
30
# bench.report('strip') do
32
# data = "Content-Length: 100\r\n"
36
# bench.report('strip!') do
38
# data = "Content-Length: 100\r\n"
42
# bench.report('index') do
44
# data = "Content-Length: 100\r\n"
52
# Rehearsal ------------------------------------------------------------
53
# chomp 0.640000 0.000000 0.640000 ( 0.644043)
54
# chomp! 0.530000 0.000000 0.530000 ( 0.531415)
55
# chop 0.620000 0.000000 0.620000 ( 0.624321)
56
# chop! 0.500000 0.000000 0.500000 ( 0.509146)
57
# strip 0.640000 0.000000 0.640000 ( 0.638785)
58
# strip! 0.530000 0.000000 0.530000 ( 0.532196)
59
# index 0.740000 0.000000 0.740000 ( 0.745742)
60
# --------------------------------------------------- total: 4.200000sec
62
# user system total real
63
# chomp 0.640000 0.010000 0.650000 ( 0.647287)
64
# chomp! 0.530000 0.000000 0.530000 ( 0.532868)
65
# chop 0.630000 0.000000 0.630000 ( 0.628236)
66
# chop! 0.520000 0.000000 0.520000 ( 0.522950)
67
# strip 0.640000 0.000000 0.640000 ( 0.646328)
68
# strip! 0.520000 0.000000 0.520000 ( 0.532715)
69
# index 0.740000 0.010000 0.750000 ( 0.771277)
74
data = "Content-Length: 100\r\n"
75
Tach.meter(1_000_000) do
99
# +--------+----------+----------+
100
# | tach | average | total |
101
# +--------+----------+----------+
102
# | chomp | 1.444547 | 1.444547 |
103
# +--------+----------+----------+
104
# | chomp! | 1.276813 | 1.276813 |
105
# +--------+----------+----------+
106
# | chop | 1.422744 | 1.422744 |
107
# +--------+----------+----------+
108
# | chop! | 1.240941 | 1.240941 |
109
# +--------+----------+----------+
110
# | strip | 1.444776 | 1.444776 |
111
# +--------+----------+----------+
112
# | strip! | 1.266459 | 1.266459 |
113
# +--------+----------+----------+
114
# | index | 1.557975 | 1.557975 |
115
# +--------+----------+----------+
b'\\ No newline at end of file'