Closed Fdawgs closed 1 year ago
Throwing this into a draft for now. @Uzlopak I noticed you've been making regex improvements in Node itself (https://github.com/nodejs/node/pull/49643), do you know if using a \w
character over [a-zA-Z0-9_]
impacts performance at all?
Tbh i never benched it. And i have no clue if it could have an impact. I mean theoretically \w gets just translated to the specific chars internally. But maybe the regex engine optimizes it somehow.
But on the other hand i never used \w because like 10 years ato I always needed to lookup if i am not mistaking it with \W :))).
Just used the benchmark in benchmark/vary.js
master
:
PR
:
a-zA-Z0-9_
inside character class with\w
word character, which is equivilentu
unicode flag to every regex pattern, which acts as a strict mode for regex. See https://github.com/fastify/fastify-autoload/pull/330Checklist
npm run test
andnpm run benchmark