Skip to content

Instantly share code, notes, and snippets.

@stemount
Created August 25, 2021 16:59
Show Gist options
  • Save stemount/66520203175383f16468d93a009a8974 to your computer and use it in GitHub Desktop.
Save stemount/66520203175383f16468d93a009a8974 to your computer and use it in GitHub Desktop.
const t1 = performance.now();
let count_y = 0;
let count_n = 0;
for (let i = 0; i < 10_000; i++) {
let message = `!play ${i}`;
if (/^!(play|playball|givecompliment)(?:\s+(\w+))?$/.test(message))
count_y += 1;
else
count_n += 1;
}
const done = performance.now() - t1;
console.log('Took', done, 'found', count_y, 'not_found', count_n);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment