find-correlation-count

Benchmark created by cagataycali on


Setup

let a = 'valued valued valued valued valued valued valued valued valued valued valued valued valued valued valued valued '
  let b = 'walked walked walked walked walked walked walked walked walked walked walked walked walked walked walked walked walked walked '
  
  const keys = new Set()
  
  for (var i = 0; i <= a.length + 1; i++) {
   keys.add(a[i])
  }

Test runner

Ready to run.

Testing in
TestOps/sec
w/o regex
var mismatch = 0
for (var i = 0; i < b.length; i++) {
 if (!keys.has(b[i])) {
   mismatch++
 }
}

console.log(mismatch)
ready
with regex
const result = a.replace(new RegExp(`[${b}]`, 'g'), '').length
console.log(result)
ready

Revisions

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

  • Revision 1: published by cagataycali on