Comparing performance of: string.indexOf(substring) !== -1; vs string.includes(substring); vs new RegExp(substring).test(string); vs string.match(new RegExp(substring));
Memory measurements supported only in Chrome.
For precise memory measurements Chrome must be launched with --enable-precise-memory-info flag.
More information: Monitoring JavaScript Memory
Test case name
Result
string.indexOf(substring) !== -1;
string.includes(substring);
new RegExp(substring).test(string);
string.match(new RegExp(substring));
Fastest:N/A
Slowest:N/A
ⓘGet performance results from real users on your website with Request Metrics.
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one to run it!