1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-11 10:07:54 -05:00

perf(ext/flash): remove string->buffer cache (#15850)

This commit is contained in:
Divy Srivastava 2022-09-10 21:53:00 +05:30 committed by cjihrig
parent e3090f11f3
commit 6abf70f10e
No known key found for this signature in database
GPG key ID: 7434390BDBE9B9C5

View file

@ -111,7 +111,6 @@
let dateInterval; let dateInterval;
let date; let date;
let stringResources = {};
// Construct an HTTP response message. // Construct an HTTP response message.
// All HTTP/1.1 messages consist of a start-line followed by a sequence // All HTTP/1.1 messages consist of a start-line followed by a sequence
@ -209,18 +208,12 @@
nwritten = respondFast(requestId, response, end); nwritten = respondFast(requestId, response, end);
} else { } else {
// string // string
const maybeResponse = stringResources[response]; nwritten = core.ops.op_flash_respond(
if (maybeResponse === undefined) { server,
stringResources[response] = core.encode(response); requestId,
nwritten = core.ops.op_flash_respond( response,
server, end,
requestId, );
stringResources[response],
end,
);
} else {
nwritten = respondFast(requestId, maybeResponse, end);
}
} }
if (nwritten < responseLen) { if (nwritten < responseLen) {
@ -578,7 +571,6 @@
date = new Date().toUTCString(); date = new Date().toUTCString();
dateInterval = setInterval(() => { dateInterval = setInterval(() => {
date = new Date().toUTCString(); date = new Date().toUTCString();
stringResources = {};
}, 1000); }, 1000);
} }