Skip to content

Commit 730c274

Browse files
committed
Fix test names
1 parent d33c6d4 commit 730c274

3 files changed

Lines changed: 16 additions & 17 deletions

File tree

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,18 @@ Comparison:
183183

184184
##### `String#casecmp` vs `String#downcase + ==` [code](code/string/casecmp-vs-downcase-==.rb)
185185

186-
187186
```
188187
$ ruby code/string/casecmp-vs-downcase-\=\=.rb
189188
Calculating -------------------------------------
190-
slow 85467 i/100ms
191-
fast 88685 i/100ms
189+
String#downcase + == 87744 i/100ms
190+
String#casecmp 77740 i/100ms
192191
-------------------------------------------------
193-
slow 2673954.97.8%) i/s - 13332852 in 5.024332s
194-
fast 3134680.4 (±12.0%) i/s - 15431190 in 5.013010s
192+
String#downcase + == 2570883.28.8%) i/s - 12810624 in 5.026806s
193+
String#casecmp 3264931.4 (±7.4%) i/s - 16247660 in 5.005434s
195194
196195
Comparison:
197-
fast: 3134680.4 i/s
198-
slow: 2673954.9 i/s - 1.17x slower
196+
String#casecmp: 3264931.4 i/s
197+
String#downcase + ==: 2570883.2 i/s - 1.27x slower
199198
```
200199

201200
### Array
@@ -310,15 +309,15 @@ Comparison:
310309
```
311310
$ ruby code/enumerable/sort-vs-sort_by.rb
312311
Calculating -------------------------------------
313-
slow 825 i/100ms
314-
fast 2028 i/100ms
312+
Enumerable#sort 1080 i/100ms
313+
Enumerable#sort_by 1949 i/100ms
315314
-------------------------------------------------
316-
slow 9679.117.7%) i/s - 46200 in 5.007614s
317-
fast 14108.629.1%) i/s - 64896 in 5.084319s
315+
Enumerable#sort 11112.04.1%) i/s - 56160 in 5.062717s
316+
Enumerable#sort_by 21105.06.8%) i/s - 107195 in 5.105145s
318317
319318
Comparison:
320-
fast: 14108.6 i/s
321-
slow: 9679.1 i/s - 1.46x slower
319+
Enumerable#sort_by: 21105.0 i/s
320+
Enumerable#sort: 11112.0 i/s - 1.90x slower
322321
```
323322

324323
### Hash

code/enumerable/sort-vs-sort_by.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def fast
1414
end
1515

1616
Benchmark.ips do |x|
17-
x.report('slow') { slow }
18-
x.report('fast') { fast }
17+
x.report('Enumerable#sort') { slow }
18+
x.report('Enumerable#sort_by') { fast }
1919
x.compare!
2020
end

code/string/casecmp-vs-downcase-==.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def fast
1111
end
1212

1313
Benchmark.ips do |x|
14-
x.report('slow') { slow }
15-
x.report('fast') { fast }
14+
x.report('String#downcase + ==') { slow }
15+
x.report('String#casecmp') { fast }
1616
x.compare!
1717
end

0 commit comments

Comments
 (0)