String Search

Benchmark published by System on

Description

Compare string searching methods.

Setup

const str = 'The quick brown fox jumps over the lazy dog'.repeat(100);
const target = 'lazy';

Test Runner

Initializing...

Testing in
Test CaseOps/sec
indexOf
str.indexOf(target) !== -1;
ready
includes
str.includes(target);
ready
RegExp.test
/lazy/.test(str);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

Revision 1
publishedby Systemon