split test (v2)

Revision 2 of this benchmark created on


Setup

const input = [
"Group::AB::C::Leaf",
"Group::AB::C",
"Group::AB",
"Group"
];

Test runner

Ready to run.

Testing in
TestOps/sec
BY SPLIT
input.forEach((name) => {
const parts = name.split('::')
})
ready
By expression
const getSplitParts = (name) => {
  if (!name) return []; // Return empty array for undefined or empty input
  return name.match(/[^:]+/g) || []; // Matches sequences of characters not including ':'
};

input.forEach((name) => {
const parts = getSplitParts(name)
})
ready

Revisions

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