{"draft":null,"from":166,"to":167,"files":[{"path":"server/src/json-chunk-cursor.ts","added":18,"removed":0,"diff":"--- a/server/src/json-chunk-cursor.ts\n+++ b/server/src/json-chunk-cursor.ts\n@@ -27,6 +27,24 @@\n \t\tif (this.take() !== '\"') throw Error(\"expected JSON string\");\n \t\tlet buffer = \"\";\n \t\tfor (;;) {\n+\t\t\t// Copy ordinary text in bounded slices instead of allocating a string\n+\t\t\t// concatenation for every character of a large canonical field.\n+\t\t\tthis.peek();\n+\t\t\tconst start = this.#offset;\n+\t\t\tconst end = Math.min(this.#chunk.length, start + 16384 - buffer.length);\n+\t\t\twhile (this.#offset < end) {\n+\t\t\t\tconst code = this.#chunk.charCodeAt(this.#offset);\n+\t\t\t\tif (code < 32 || code === 34 || code === 92) break;\n+\t\t\t\tthis.#offset++;\n+\t\t\t}\n+\t\t\tif (this.#offset > start) {\n+\t\t\t\tbuffer += this.#chunk.slice(start, this.#offset);\n+\t\t\t\tif (buffer.length === 16384) {\n+\t\t\t\t\tyield buffer;\n+\t\t\t\t\tbuffer = \"\";\n+\t\t\t\t}\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t\tlet char = this.take();\n \t\t\tif (char === '\"') {\n \t\t\t\tif (buffer) yield buffer;"}],"unmatched":[]}