From 6abf70f10e8a5d40eb62262755d18089a256f3dc Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sat, 10 Sep 2022 21:53:00 +0530 Subject: [PATCH] perf(ext/flash): remove string->buffer cache (#15850) --- ext/flash/01_http.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/ext/flash/01_http.js b/ext/flash/01_http.js index 949eb0ac31..b28989ccb3 100644 --- a/ext/flash/01_http.js +++ b/ext/flash/01_http.js @@ -111,7 +111,6 @@ let dateInterval; let date; - let stringResources = {}; // Construct an HTTP response message. // All HTTP/1.1 messages consist of a start-line followed by a sequence @@ -209,18 +208,12 @@ nwritten = respondFast(requestId, response, end); } else { // string - const maybeResponse = stringResources[response]; - if (maybeResponse === undefined) { - stringResources[response] = core.encode(response); - nwritten = core.ops.op_flash_respond( - server, - requestId, - stringResources[response], - end, - ); - } else { - nwritten = respondFast(requestId, maybeResponse, end); - } + nwritten = core.ops.op_flash_respond( + server, + requestId, + response, + end, + ); } if (nwritten < responseLen) { @@ -578,7 +571,6 @@ date = new Date().toUTCString(); dateInterval = setInterval(() => { date = new Date().toUTCString(); - stringResources = {}; }, 1000); }