stash-6352

Benchmark created on


Setup

const array = [
  "https://google.com",
  "https://www.google.com",
  "http://google.com",
  "https://google.com"
]

function origKey(url) {
  let key = url;
  // Remove http:// or https://
  key = key.replace(/^https?:\/\//, "");
  // Remove www. prefix
  key = key.replace(/^www\./, "");
  return key.toLowerCase();
}

const arrowKey = (url) =>
	url.toLowerCase().replace(/^(https?:\/\/)?(www\.)?/, '')

Test runner

Ready to run.

Testing in
TestOps/sec
original
array.map(url => origKey(url))
ready
arrow
array.map(url => arrowKey(url))
ready

Revisions

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