Skip to content

Commit 256fa49

Browse files
committed
Fix headings, commands, and code links
1 parent 9ac23c8 commit 256fa49

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

README.md

+26-26
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ Comparison:
207207
ancestors.include?: 192602.9 i/s - 6.49x slower
208208
```
209209

210-
#### Method Invocation
210+
### Method Invocation
211211

212212
##### `call` vs `send` vs `method_missing` [code](code/method/call-vs-send-vs-method_missing.rb)
213213

@@ -309,8 +309,7 @@ Comparison:
309309
##### Kernel#format vs Float#round().to_s [code](code/general/format-vs-round-and-to-s.rb)
310310

311311
```
312-
$ ruby -v code/general/format-vs-round-and-t
313-
o-s.rb
312+
$ ruby -v code/general/format-vs-round-and-to-s.rb
314313
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin15]
315314
Warming up --------------------------------------
316315
Float#round 106.645k i/100ms
@@ -561,6 +560,7 @@ Similar comparisons hold for `Enumerable#sort_by.last` vs
561560
`Enumerable#sort.last` vs `Enumerable#max`.
562561

563562
```
563+
$ ruby -v code/enumerable/sort_by-first-vs-min_by.rb
564564
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
565565
Warming up --------------------------------------
566566
Enumerable#min_by 15.170k i/100ms
@@ -638,7 +638,7 @@ Enumerable#sort_by (Symbol#to_proc): 25916.1 i/s
638638
Of note, `to_proc` for 1.8.7 is considerable slower than the block format
639639

640640
```
641-
$ ruby -v code/enumerable/inject-sum-vs-block.rb
641+
$ ruby -v code/enumerable/inject-symbol-vs-block.rb
642642
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin14]
643643
Warming up --------------------------------------
644644
inject symbol 1.893k i/100ms
@@ -805,13 +805,14 @@ Comparison:
805805
Hash#keys.each: 869262.3 i/s - 1.21x slower
806806
```
807807

808-
#### `Hash#key?` instead of `Hash#keys.include?` [code](code/hash/keys-include-vs-\[\]-vs-key.rb)
808+
#### `Hash#key?` instead of `Hash#keys.include?` [code](code/hash/keys-include-vs-key.rb)
809809

810810
> `Hash#keys.include?` allocates an array of keys and performs an O(n) search; <br>
811811
> `Hash#key?` performs an O(1) hash lookup without allocating a new array.
812812
813813
```
814-
$ ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
814+
$ ruby -v code/hash/keys-include-vs-key.rb
815+
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
815816
816817
Calculating -------------------------------------
817818
Hash#keys.include? 8.612k (± 2.5%) i/s - 43.248k in 5.024749s
@@ -861,7 +862,7 @@ Comparison:
861862
##### `Hash#merge` vs `Hash#**other` [code](code/hash/merge-vs-double-splat-operator.rb)
862863

863864
```
864-
$ ruby -v merge-vs-double-splat-operator.rb
865+
$ ruby -v code/hash/merge-vs-double-splat-operator.rb
865866
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin15]
866867
Warming up --------------------------------------
867868
Hash#**other 64.624k i/100ms
@@ -937,8 +938,7 @@ Comparison:
937938
sort + to_h: 81972.8 i/s - 1.49x slower
938939
```
939940

940-
##### Native `Hash#slice` vs other slice implementations before native
941-
[code](code/hash/slice-native-vs-before-native.rb)
941+
##### Native `Hash#slice` vs other slice implementations before native [code](code/hash/slice-native-vs-before-native.rb)
942942

943943
Since ruby 2.5, Hash comes with a `slice` method to select hash members by keys.
944944

@@ -1053,15 +1053,15 @@ always `ASCII-8BIT` encoded instead of the script encoding (usually `UTF-8`).
10531053

10541054
```
10551055
$ ruby -v code/string/dup-vs-unary-plus.rb
1056-
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin17]
1056+
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin17]
10571057
1058-
Calculating -------------------------------------
1059-
String#+@ 7.697M (± 1.4%) i/s - 38.634M in 5.020313s
1060-
String#dup 3.566M (± 1.0%) i/s - 17.860M in 5.008377s
1058+
Calculating -------------------------------------
1059+
String#+@ 7.697M (± 1.4%) i/s - 38.634M in 5.020313s
1060+
String#dup 3.566M (± 1.0%) i/s - 17.860M in 5.008377s
10611061
1062-
Comparison:
1063-
String#+@: 7697108.3 i/s
1064-
String#dup: 3566485.7 i/s - 2.16x slower
1062+
Comparison:
1063+
String#+@: 7697108.3 i/s
1064+
String#dup: 3566485.7 i/s - 2.16x slower
10651065
```
10661066

10671067
##### `String#casecmp` vs `String#downcase + ==` [code](code/string/casecmp-vs-downcase-==.rb)
@@ -1126,17 +1126,17 @@ longer. For short strings, `String#match?` performs similarly to
11261126
11271127
```
11281128
$ ruby -v code/string/start-string-checking-match-vs-start_with.rb
1129-
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin17]
1129+
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin17]
11301130
1131-
Calculating -------------------------------------
1132-
String#=~ 1.088M (± 4.0%) i/s - 5.471M in 5.034404s
1133-
String#match? 5.138M (± 5.0%) i/s - 25.669M in 5.008810s
1134-
String#start_with? 6.314M (± 4.3%) i/s - 31.554M in 5.007207s
1131+
Calculating -------------------------------------
1132+
String#=~ 1.088M (± 4.0%) i/s - 5.471M in 5.034404s
1133+
String#match? 5.138M (± 5.0%) i/s - 25.669M in 5.008810s
1134+
String#start_with? 6.314M (± 4.3%) i/s - 31.554M in 5.007207s
11351135
1136-
Comparison:
1137-
String#start_with?: 6314182.0 i/s
1138-
String#match?: 5138115.1 i/s - 1.23x slower
1139-
String#=~: 1088461.5 i/s - 5.80x slower
1136+
Comparison:
1137+
String#start_with?: 6314182.0 i/s
1138+
String#match?: 5138115.1 i/s - 1.23x slower
1139+
String#=~: 1088461.5 i/s - 5.80x slower
11401140
```
11411141

11421142
```
@@ -1397,7 +1397,7 @@ Comparison:
13971397

13981398
### Range
13991399

1400-
#### `cover?` vs `include?` [code](code/range/cover-vs-include.rb)
1400+
##### `cover?` vs `include?` [code](code/range/cover-vs-include.rb)
14011401

14021402
`cover?` only check if it is within the start and end, `include?` needs to traverse the whole range.
14031403

0 commit comments

Comments
 (0)