summaryrefslogtreecommitdiff
path: root/ext/fetch/23_response.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/fetch/23_response.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/fetch/23_response.js')
-rw-r--r--ext/fetch/23_response.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/fetch/23_response.js b/ext/fetch/23_response.js
index 52ebc91fe..dc4e75434 100644
--- a/ext/fetch/23_response.js
+++ b/ext/fetch/23_response.js
@@ -37,7 +37,7 @@ const {
ObjectDefineProperties,
ObjectPrototypeIsPrototypeOf,
RangeError,
- RegExpPrototypeTest,
+ RegExpPrototypeExec,
SafeArrayIterator,
SafeRegExp,
Symbol,
@@ -179,7 +179,7 @@ function initializeAResponse(response, init, bodyWithType) {
// 2.
if (
init.statusText &&
- !RegExpPrototypeTest(REASON_PHRASE_RE, init.statusText)
+ RegExpPrototypeExec(REASON_PHRASE_RE, init.statusText) === null
) {
throw new TypeError("Status text is not valid.");
}