summaryrefslogtreecommitdiff
path: root/ext/webidl/00_webidl.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-06-05 10:52:40 +0200
committerGitHub <noreply@github.com>2023-06-05 10:52:40 +0200
commit21c2c01ebed902c70763bb9319c3ec48c4cb5284 (patch)
tree82f01c418fc9abfb39aa370b3f3a6af820b10abb /ext/webidl/00_webidl.js
parentadf41edda12a26a84cb8b4252404aae2a9e7ae03 (diff)
perf: optimize RegExp usage in JS (#19364)
Towards https://github.com/denoland/deno/issues/19330 Shows about 1% improvement in the HTTP benchmark.
Diffstat (limited to 'ext/webidl/00_webidl.js')
-rw-r--r--ext/webidl/00_webidl.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js
index dfaa774e2..ca1c7c606 100644
--- a/ext/webidl/00_webidl.js
+++ b/ext/webidl/00_webidl.js
@@ -59,6 +59,7 @@ const {
ReflectHas,
ReflectOwnKeys,
RegExpPrototypeTest,
+ RegExpPrototypeExec,
SafeRegExp,
SafeSet,
SetPrototypeEntries,
@@ -406,7 +407,7 @@ converters.DOMString = function (V, prefix, context, opts = {}) {
const IS_BYTE_STRING = new SafeRegExp(/^[\x00-\xFF]*$/);
converters.ByteString = (V, prefix, context, opts) => {
const x = converters.DOMString(V, prefix, context, opts);
- if (!RegExpPrototypeTest(IS_BYTE_STRING, x)) {
+ if (RegExpPrototypeExec(IS_BYTE_STRING, x) === null) {
throw makeException(
TypeError,
"is not a valid ByteString",