Test name | Executions per second |
---|---|
toLowerCase_includes | 20889.9 Ops/sec |
Regex_indexOf | 24866.0 Ops/sec |
var words = Array.from({ length: 1000 }, (_, i) => `word${i + 1}`);
var searchString = "WORD512";
var searchStringRegex = new RegExp(searchString, 'i');
const filteredCase1 = words.filter(word => word.toLowerCase().includes(searchString.toLowerCase()));
const filteredCase2 = words.filter(word => searchStringRegex.test(word));