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
Copy file name to clipboardExpand all lines: README.md
+26-24Lines changed: 26 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -975,7 +975,11 @@ Comparison:
975
975
String#+: 2977282.7 i/s - 1.80x slower
976
976
```
977
977
978
-
##### `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)
978
+
##### `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)
979
+
980
+
The regular expression approaches become slower as the tested string becomes
981
+
longer. For short strings, `String#match?` performs similarly to
982
+
`String#start_with?`/`String#end_with?`.
979
983
980
984
> :warning: <br>
981
985
> Sometimes you cant replace regexp with `start_with?`, <br>
0 commit comments