{"draft":null,"from":246,"to":247,"files":[{"path":"src/engine/view.ts","added":10,"removed":1,"diff":"--- a/src/engine/view.ts\n+++ b/src/engine/view.ts\n@@ -74,7 +74,7 @@\n \t// FileState and FileAttrs are per laid-out file; typed-array headers are separate from their payload byte lengths.\n \tn = OBJECT_BYTES + OBJECT_BYTES + 2 * ARRAY_HEADER_BYTES;\n \tn += f.seq.byteLength + f.vis.byteLength;\n-\tif (f.visText) for (const text of f.visText) n += REFERENCE_BYTES + 2 * (text?.length ?? 0);\n+\tif (f.visText) for (const text of f.visText) n += REFERENCE_BYTES + (text === null ? 0 : stringBytes(text));\n \tif (f.visWriter) n += 4 * f.visWriter.length;\n \tif (f.visK) n += 4 * f.visK.length;\n \tif (f.seqWriter) n += 4 * f.seqWriter.length;\n@@ -131,7 +131,16 @@\n const MAP_ENTRY_BYTES = 40;\n const SET_ENTRY_BYTES = 32;\n const REFERENCE_BYTES = 8;\n+const STRING_HEADER_BYTES = 16;\n /**\n+ * What V8 holds for a string of its own (abso Capacity, measured on abso's layouts): a header, then one byte a\n+ * character when every character fits in Latin-1 and two otherwise, rounded up to 8.\n+ */\n+function stringBytes(text: string): number {\n+\tconst chars = /[^\\u0000-\\u00ff]/.test(text) ? 2 * text.length : text.length;\n+\treturn (STRING_HEADER_BYTES + chars + 7) & ~7;\n+}\n+/**\n  * Moved lines a view resolves once and keeps (abso Capacity): a stored graph otherwise resolved every move again on\n  * disk for each file it laid out. Game's whole history has 290; past this many, the view goes back to that.\n  */"}],"unmatched":[]}