Optimize memory footprint in outline conversion

This commit is contained in:
be5invis 2023-12-22 07:51:55 -08:00
parent f287d352da
commit e29df67587
10 changed files with 411 additions and 378 deletions

View file

@ -1,11 +1,12 @@
{
"name": "@iosevka/geometry-cache",
"version": "28.0.2",
"private": true,
"exports": {
".": "./src/index.mjs"
},
"dependencies": {
"@msgpack/msgpack": "^2.8.0"
}
"name": "@iosevka/geometry-cache",
"version": "28.0.2",
"private": true,
"exports": {
".": "./src/index.mjs"
},
"dependencies": {
"@iosevka/geometry": "28.0.2",
"@msgpack/msgpack": "^2.8.0"
}
}

View file

@ -1,9 +1,10 @@
import fs from "fs";
import zlib from "zlib";
import * as CurveUtil from "@iosevka/geometry/curve-util";
import { encode, decode } from "@msgpack/msgpack";
const Edition = 30;
const Edition = 31;
const MAX_AGE = 16;
class GfEntry {
constructor(age, value) {
@ -23,7 +24,8 @@ class Cache {
this.historyAgeKeys = rep.ageKeys.slice(0, MAX_AGE);
const ageKeySet = new Set(this.historyAgeKeys);
for (const [k, e] of Object.entries(rep.gf)) {
if (ageKeySet.has(e.age)) this.gf.set(k, new GfEntry(e.age, e.value));
if (ageKeySet.has(e.age))
this.gf.set(k, new GfEntry(e.age, CurveUtil.repToShape(e.value)));
}
}
toRep(version, diffOnly) {