replace test

Benchmark created on


Setup

function genString() {
	return (Math.random() + 1).toString(36);
}

const data = [];
for (let i = 0; i < 1000; i++) {
	data.push(genString())
}

Test runner

Ready to run.

Testing in
TestOps/sec
separate
data.map((cell) => {
  if (cell.includes('|') || cell.includes('"') || /(\r){0,1}\n/.test(cell)
  ) {
  }
  return cell;
})
ready
combined
data.map((cell) => {
	const regExp = /[|"((\r){0,1}\n)]/g;
  if (regExp.test(cell)) {
  }
  return cell;
})
ready

Revisions

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