mirror of
https://github.com/denoland/deno.git
synced 2025-07-23 05:05:08 +00:00
perf: optimize RegExp usage in JS (#19364)
Towards https://github.com/denoland/deno/issues/19330 Shows about 1% improvement in the HTTP benchmark.
This commit is contained in:
parent
adf41edda1
commit
21c2c01ebe
6 changed files with 19 additions and 16 deletions
|
@ -36,7 +36,7 @@ const {
|
|||
ArrayPrototypeSplice,
|
||||
ObjectKeys,
|
||||
ObjectPrototypeIsPrototypeOf,
|
||||
RegExpPrototypeTest,
|
||||
RegExpPrototypeExec,
|
||||
StringPrototypeStartsWith,
|
||||
Symbol,
|
||||
SymbolFor,
|
||||
|
@ -227,7 +227,7 @@ function validateAndNormalizeMethod(m) {
|
|||
}
|
||||
|
||||
// Regular path
|
||||
if (!RegExpPrototypeTest(HTTP_TOKEN_CODE_POINT_RE, m)) {
|
||||
if (RegExpPrototypeExec(HTTP_TOKEN_CODE_POINT_RE, m) === null) {
|
||||
throw new TypeError("Method is not valid.");
|
||||
}
|
||||
const upperCase = byteUpperCase(m);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue