You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hash#keys.include? (key is present): 8913.6 i/s - 651.72x slower
828
+
829
+
Calculating -------------------------------------
830
+
Hash#key? (key is absent)
831
+
7.691M (± 1.9%) i/s - 38.520M in 5.010779s
832
+
Hash#keys.include? (key is absent)
833
+
2.991k (± 2.1%) i/s - 15.100k in 5.051475s
834
+
835
+
Comparison:
836
+
Hash#key? (key is absent): 7690551.0 i/s
837
+
Hash#keys.include? (key is absent): 2990.5 i/s - 2571.62x slower
838
+
839
+
Calculating -------------------------------------
840
+
Hash#value? (value is present)
841
+
14.780k (± 0.9%) i/s - 74.970k in 5.072806s
842
+
Hash#values.include? (value is present)
843
+
14.019k (± 4.4%) i/s - 70.533k in 5.041592s
844
+
845
+
Comparison:
846
+
Hash#value? (value is present): 14780.1 i/s
847
+
Hash#values.include? (value is present): 14019.0 i/s - 1.05x slower
848
+
849
+
Calculating -------------------------------------
850
+
Hash#value? (value is absent)
851
+
2.640k (± 2.1%) i/s - 13.200k in 5.002081s
852
+
Hash#values.include? (value is absent)
853
+
2.930k (± 6.1%) i/s - 14.994k in 5.144089s
854
+
855
+
Comparison:
856
+
Hash#values.include? (value is absent): 2930.0 i/s
857
+
Hash#value? (value is absent): 2640.1 i/s - 1.11x slower
858
+
```
859
+
808
860
##### `Hash#merge!` vs `Hash#[]=`[code](code/hash/merge-bang-vs-\[\]=.rb)
809
861
810
862
```
@@ -1020,7 +1072,7 @@ Comparison:
1020
1072
##### `String#match` vs `String.match?` vs `String#start_with?`/`String#end_with?`[code (start)](code/string/start-string-checking-match-vs-start_with.rb)[code (end)](code/string/end-string-checking-match-vs-end_with.rb)
1021
1073
1022
1074
The regular expression approaches become slower as the tested string becomes
1023
-
longer. For short strings, `String#match?` performs similarly to
1075
+
longer. For short strings, `String#match?` performs similarly to
0 commit comments