Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Multimatch of Regex vs findIndex
(version: 0)
Comparing performance of:
findIndex vs Regex
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var data = "ggggggggg"; var matchers = [...Array.from({ length: 30 }).map((_, i) => "dummy" + i), "aaaa", "bbbb", "ccccc", "dddddddd", "eeeeee", "fffffffff", "ggggggggg", "hhhhhhhh"]; var regex = new RegExp(`(^|\\.)(${matchers.join('|')})$`);
Tests:
findIndex
var found = !!matchers.findIndex(key => key === data);
Regex
var found = regex.test(data);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
findIndex
Regex
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
includes vs indexOf vs findIndex vs Regex
RegEx vs Array.includes
RegEx vs Array.includes v2
RegEx.test vs Array.includes — fork 1
Comments
Confirm delete:
Do you really want to delete benchmark?