string.split string vs regex (v2)

Revision 2 of this benchmark created on


Setup

const testId = "hello-there"

Test runner

Ready to run.

Testing in
TestOps/sec
string.split with string parameter
testId.split('-');
ready
string.split with regex parameter
testId.split(/(?<=[0-9a-f])-/)
ready
string.find and slice
const index = testId.indexOf('-')
const targetId = index > -1 ? testId.slice(index + 1): null;
ready

Revisions

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