matchPattern is faster than findString
When searching for a substring inside a string, using the matchPattern() method is faster than using findString().
Executing the same method one million times on the same PC resulted in:
3.7 seconds execution time for
matchPattern5.9 seconds execution time for
findString5.0 seconds execution time for
subStringwhen comparing the first 3 characters.
Previous Tip
Recursive functions can be faster
Next Tip
