Optimize non-cached build performance

This commit is contained in:
be5invis 2023-12-22 01:53:19 -08:00
parent 65547da947
commit dcdf72eea3
17 changed files with 141 additions and 114 deletions

28
package-lock.json generated
View file

@ -1882,9 +1882,9 @@
"dev": true "dev": true
}, },
"node_modules/fastq": { "node_modules/fastq": {
"version": "1.15.0", "version": "1.16.0",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz",
"integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"reusify": "^1.0.4" "reusify": "^1.0.4"
@ -3665,9 +3665,9 @@
} }
}, },
"node_modules/typo-geom": { "node_modules/typo-geom": {
"version": "0.13.1", "version": "0.13.2",
"resolved": "https://registry.npmjs.org/typo-geom/-/typo-geom-0.13.1.tgz", "resolved": "https://registry.npmjs.org/typo-geom/-/typo-geom-0.13.2.tgz",
"integrity": "sha512-3FQwaV5O3JDV21zKSka3uv+biY/XParUagiyS40uu1dcEgq1A381KON1N42vsyLnY0Eixwg9umLdRqKU63ds1w==", "integrity": "sha512-0xEeNX/bQl/qx1+jgMy7ObtyUK9SmdhZALCNTs2dHyTTCCpHRNHL1nPw+Us0ZmxbLRi9gy5GpINJ3tynE8K6Pw==",
"dependencies": { "dependencies": {
"clipper-lib": "^6.4.2", "clipper-lib": "^6.4.2",
"tslib": "^2.6.2" "tslib": "^2.6.2"
@ -3982,9 +3982,7 @@
"@iosevka/util": "28.0.2", "@iosevka/util": "28.0.2",
"harfbuzzjs": "^0.3.4", "harfbuzzjs": "^0.3.4",
"ot-builder": "^1.7.3", "ot-builder": "^1.7.3",
"semver": "^7.5.4", "semver": "^7.5.4"
"spiro": "^3.0.0",
"typo-geom": "^0.13.1"
} }
}, },
"packages/font-glyphs": { "packages/font-glyphs": {
@ -3996,7 +3994,7 @@
"@iosevka/geometry-cache": "28.0.2", "@iosevka/geometry-cache": "28.0.2",
"@iosevka/glyph": "28.0.2", "@iosevka/glyph": "28.0.2",
"@iosevka/util": "28.0.2", "@iosevka/util": "28.0.2",
"typo-geom": "^0.13.1" "typo-geom": "^0.13.2"
} }
}, },
"packages/font-kits": { "packages/font-kits": {
@ -4005,9 +4003,7 @@
"dependencies": { "dependencies": {
"@iosevka/geometry": "28.0.2", "@iosevka/geometry": "28.0.2",
"@iosevka/glyph": "28.0.2", "@iosevka/glyph": "28.0.2",
"@iosevka/util": "28.0.2", "@iosevka/util": "28.0.2"
"spiro": "^3.0.0",
"typo-geom": "^0.13.1"
} }
}, },
"packages/font-otl": { "packages/font-otl": {
@ -4025,7 +4021,7 @@
"dependencies": { "dependencies": {
"@iosevka/util": "28.0.2", "@iosevka/util": "28.0.2",
"spiro": "^3.0.0", "spiro": "^3.0.0",
"typo-geom": "^0.13.1" "typo-geom": "^0.13.2"
} }
}, },
"packages/geometry-cache": { "packages/geometry-cache": {
@ -4039,9 +4035,7 @@
"name": "@iosevka/glyph", "name": "@iosevka/glyph",
"version": "28.0.2", "version": "28.0.2",
"dependencies": { "dependencies": {
"@iosevka/geometry": "28.0.2", "@iosevka/geometry": "28.0.2"
"spiro": "^3.0.0",
"typo-geom": "^0.13.1"
} }
}, },
"packages/param": { "packages/param": {

View file

@ -1,18 +1,18 @@
{ {
"name": "@iosevka/font-glyphs", "name": "@iosevka/font-glyphs",
"version": "28.0.2", "version": "28.0.2",
"private": true, "private": true,
"exports": { "exports": {
".": "./src/index.mjs", ".": "./src/index.mjs",
"./aesthetics": "./src/meta/aesthetics.mjs", "./aesthetics": "./src/meta/aesthetics.mjs",
"./unicode-knowledge": "./src/meta/unicode-knowledge.mjs" "./unicode-knowledge": "./src/meta/unicode-knowledge.mjs"
}, },
"dependencies": { "dependencies": {
"@iosevka/font-kits": "28.0.2", "@iosevka/font-kits": "28.0.2",
"@iosevka/geometry": "28.0.2", "@iosevka/geometry": "28.0.2",
"@iosevka/geometry-cache": "28.0.2", "@iosevka/geometry-cache": "28.0.2",
"@iosevka/glyph": "28.0.2", "@iosevka/glyph": "28.0.2",
"@iosevka/util": "28.0.2", "@iosevka/util": "28.0.2",
"typo-geom": "^0.13.1" "typo-geom": "^0.13.2"
} }
} }

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl' $$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util" import [mix linreg clamp fallback] from "@iosevka/util"
import [TieMark AnyDerivingCv ScheduleLeaningMark LeaningMark LeaningMarkSpacer] from "@iosevka/glyph/relation" import [TieMark AnyDerivingCv ScheduleLeaningMark LeaningMark LeaningMarkSpacer] from "@iosevka/glyph/relation"

View file

@ -1,6 +1,6 @@
$$include '../meta/macros.ptl' $$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom" import [Arcs ShapeConv] from "typo-geom"
import [OffsetCurve BezToContoursSink GEOMETRY_PRECISION] from "@iosevka/geometry/curve-util" import [OffsetCurve BezToContoursSink GEOMETRY_PRECISION] from "@iosevka/geometry/curve-util"
import [mix linreg clamp fallback] from "@iosevka/util" import [mix linreg clamp fallback] from "@iosevka/util"
import [DesignParameters] from "../meta/aesthetics.mjs" import [DesignParameters] from "../meta/aesthetics.mjs"

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl' $$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util" import [mix linreg clamp fallback] from "@iosevka/util"
import [ScheduleLeaningMark] from "@iosevka/glyph/relation" import [ScheduleLeaningMark] from "@iosevka/glyph/relation"

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl' $$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util" import [mix linreg clamp fallback] from "@iosevka/util"
glyph-module glyph-module

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl' $$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util" import [mix linreg clamp fallback] from "@iosevka/util"
import [DesignParameters] from "../meta/aesthetics.mjs" import [DesignParameters] from "../meta/aesthetics.mjs"

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl' $$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util" import [mix linreg clamp fallback] from "@iosevka/util"
glyph-module glyph-module

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl' $$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util" import [mix linreg clamp fallback] from "@iosevka/util"
import [DesignParameters] from "../meta/aesthetics.mjs" import [DesignParameters] from "../meta/aesthetics.mjs"

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl' $$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util" import [mix linreg clamp fallback] from "@iosevka/util"
import [TieMark TieGlyph] from "@iosevka/glyph/relation" import [TieMark TieGlyph] from "@iosevka/glyph/relation"

View file

@ -1,16 +1,14 @@
{ {
"name": "@iosevka/font-kits", "name": "@iosevka/font-kits",
"version": "28.0.2", "version": "28.0.2",
"private": true, "private": true,
"exports": { "exports": {
"./boole-kit": "./src/boole-kit.mjs", "./boole-kit": "./src/boole-kit.mjs",
"./spiro-kit": "./src/spiro-kit.mjs" "./spiro-kit": "./src/spiro-kit.mjs"
}, },
"dependencies": { "dependencies": {
"@iosevka/geometry": "28.0.2", "@iosevka/geometry": "28.0.2",
"@iosevka/glyph": "28.0.2", "@iosevka/glyph": "28.0.2",
"@iosevka/util": "28.0.2", "@iosevka/util": "28.0.2"
"spiro": "^3.0.0", }
"typo-geom": "^0.13.1"
}
} }

View file

@ -1,26 +1,24 @@
{ {
"name": "@iosevka/font", "name": "@iosevka/font",
"version": "28.0.2", "version": "28.0.2",
"private": true, "private": true,
"exports": { "exports": {
".": "./src/index.mjs", ".": "./src/index.mjs",
"./anchor": "./src/anchor.mjs", "./anchor": "./src/anchor.mjs",
"./point": "./src/point.mjs", "./point": "./src/point.mjs",
"./transform": "./src/transform.mjs" "./transform": "./src/transform.mjs"
}, },
"dependencies": { "dependencies": {
"@iarna/toml": "^2.2.5", "@iarna/toml": "^2.2.5",
"@iosevka/font-glyphs": "28.0.2", "@iosevka/font-glyphs": "28.0.2",
"@iosevka/font-otl": "28.0.2", "@iosevka/font-otl": "28.0.2",
"@iosevka/geometry": "28.0.2", "@iosevka/geometry": "28.0.2",
"@iosevka/geometry-cache": "28.0.2", "@iosevka/geometry-cache": "28.0.2",
"@iosevka/glyph": "28.0.2", "@iosevka/glyph": "28.0.2",
"@iosevka/param": "28.0.2", "@iosevka/param": "28.0.2",
"@iosevka/util": "28.0.2", "@iosevka/util": "28.0.2",
"harfbuzzjs": "^0.3.4", "harfbuzzjs": "^0.3.4",
"ot-builder": "^1.7.3", "ot-builder": "^1.7.3",
"semver": "^7.5.4", "semver": "^7.5.4"
"spiro": "^3.0.0", }
"typo-geom": "^0.13.1"
}
} }

View file

@ -88,16 +88,20 @@ class SimplifyGeometry extends Geom.GeometryBase {
this.m_geom = g; this.m_geom = g;
} }
asContours() { asContours() {
const source = this.m_geom.asContours(); // Produce simplified arcs
let arcs = CurveUtil.convertShapeToArcs(this.m_geom.asContours());
if (!this.m_geom.producesSimpleContours()) {
arcs = TypoGeom.Boolean.removeOverlap(
arcs,
TypoGeom.Boolean.PolyFillType.pftNonZero,
CurveUtil.BOOLE_RESOLUTION
);
}
// Convert to TT curves
const sink = new QuadifySink(); const sink = new QuadifySink();
TypoGeom.ShapeConv.transferGenericShape( TypoGeom.ShapeConv.transferGenericShape(
TypoGeom.Fairize.fairizeBezierShape( TypoGeom.Fairize.fairizeBezierShape(arcs),
TypoGeom.Boolean.removeOverlap(
CurveUtil.convertShapeToArcs(source),
TypoGeom.Boolean.PolyFillType.pftNonZero,
CurveUtil.BOOLE_RESOLUTION
)
),
sink, sink,
CurveUtil.GEOMETRY_PRECISION CurveUtil.GEOMETRY_PRECISION
); );

View file

@ -3,7 +3,7 @@ import zlib from "zlib";
import { encode, decode } from "@msgpack/msgpack"; import { encode, decode } from "@msgpack/msgpack";
const Edition = 29; const Edition = 30;
const MAX_AGE = 16; const MAX_AGE = 16;
class GfEntry { class GfEntry {
constructor(age, value) { constructor(age, value) {

View file

@ -15,6 +15,6 @@
"dependencies": { "dependencies": {
"@iosevka/util": "28.0.2", "@iosevka/util": "28.0.2",
"spiro": "^3.0.0", "spiro": "^3.0.0",
"typo-geom": "^0.13.1" "typo-geom": "^0.13.2"
} }
} }

View file

@ -16,6 +16,9 @@ export class GeometryBase {
asReferences() { asReferences() {
throw new Error("Unimplemented"); throw new Error("Unimplemented");
} }
producesSimpleContours() {
return false;
}
getDependencies() { getDependencies() {
throw new Error("Unimplemented"); throw new Error("Unimplemented");
} }
@ -217,6 +220,9 @@ export class ReferenceGeometry extends GeometryBase {
if (this.isEmpty()) return []; if (this.isEmpty()) return [];
return [{ glyph: this.m_glyph, x: this.m_x, y: this.m_y }]; return [{ glyph: this.m_glyph, x: this.m_x, y: this.m_y }];
} }
producesSimpleContours() {
return this.unwrap().producesSimpleContours();
}
getDependencies() { getDependencies() {
return [this.m_glyph]; return [this.m_glyph];
} }
@ -253,6 +259,9 @@ export class TaggedGeometry extends GeometryBase {
asReferences() { asReferences() {
return this.m_geom.asReferences(); return this.m_geom.asReferences();
} }
producesSimpleContours() {
return this.m_geom.producesSimpleContours();
}
getDependencies() { getDependencies() {
return this.m_geom.getDependencies(); return this.m_geom.getDependencies();
} }
@ -298,6 +307,9 @@ export class TransformedGeometry extends GeometryBase {
result.push({ glyph, x: x + this.m_transform.x, y: y + this.m_transform.y }); result.push({ glyph, x: x + this.m_transform.x, y: y + this.m_transform.y });
return result; return result;
} }
producesSimpleContours() {
return this.m_geom.producesSimpleContours();
}
getDependencies() { getDependencies() {
return this.m_geom.getDependencies(); return this.m_geom.getDependencies();
} }
@ -350,6 +362,9 @@ export class RadicalGeometry extends GeometryBase {
asReferences() { asReferences() {
return null; return null;
} }
producesSimpleContours() {
return this.m_geom.producesSimpleContours();
}
getDependencies() { getDependencies() {
return this.m_geom.getDependencies(); return this.m_geom.getDependencies();
} }
@ -406,6 +421,11 @@ export class CombineGeometry extends GeometryBase {
} }
return results; return results;
} }
producesSimpleContours() {
if (this.m_parts.length === 0) return true;
if (this.m_parts.length > 1) return false;
return this.m_parts[0].producesSimpleContours();
}
getDependencies() { getDependencies() {
let results = []; let results = [];
for (const part of this.m_parts) { for (const part of this.m_parts) {
@ -468,21 +488,43 @@ export class BooleanGeometry extends GeometryBase {
} }
asContoursImpl() { asContoursImpl() {
if (this.m_operands.length === 0) return []; if (this.m_operands.length === 0) return [];
let arcs = CurveUtil.convertShapeToArcs(this.m_operands[0].asContours());
for (let j = 1; j < this.m_operands.length; j++) { const stack = [];
arcs = TypoGeom.Boolean.combine( this.asOpStackImpl(stack);
this.m_operator, const arcs = TypoGeom.Boolean.combineStack(stack, CurveUtil.BOOLE_RESOLUTION);
arcs,
CurveUtil.convertShapeToArcs(this.m_operands[j].asContours()),
TypoGeom.Boolean.PolyFillType.pftNonZero,
TypoGeom.Boolean.PolyFillType.pftNonZero,
CurveUtil.BOOLE_RESOLUTION
);
}
const ctx = new CurveUtil.BezToContoursSink(); const ctx = new CurveUtil.BezToContoursSink();
TypoGeom.ShapeConv.transferBezArcShape(arcs, ctx); TypoGeom.ShapeConv.transferBezArcShape(arcs, ctx);
return ctx.contours; return ctx.contours;
} }
asOpStackImpl(sink) {
if (this.m_operands.length === 0) {
sink.push({
type: "operand",
fillType: TypoGeom.Boolean.PolyFillType.pftNonZero,
shape: []
});
return;
}
for (const [i, operand] of this.m_operands.entries()) {
// Push operand
if (operand instanceof BooleanGeometry) {
operand.asOpStackImpl(sink);
} else {
sink.push({
type: "operand",
fillType: TypoGeom.Boolean.PolyFillType.pftNonZero,
shape: CurveUtil.convertShapeToArcs(operand.asContours())
});
}
// Push operator if i > 0
if (i > 0) sink.push({ type: "operator", operator: this.m_operator });
}
}
producesSimpleContours() {
return this.m_operands.length > 1;
}
asReferences() { asReferences() {
return null; return null;
} }

View file

@ -1,16 +1,14 @@
{ {
"name": "@iosevka/glyph", "name": "@iosevka/glyph",
"version": "28.0.2", "version": "28.0.2",
"private": true, "private": true,
"exports": { "exports": {
".": "./src/glyph.mjs", ".": "./src/glyph.mjs",
"./store": "./src/store.mjs", "./store": "./src/store.mjs",
"./block": "./src/block.mjs", "./block": "./src/block.mjs",
"./relation": "./src/relation.mjs" "./relation": "./src/relation.mjs"
}, },
"dependencies": { "dependencies": {
"@iosevka/geometry": "28.0.2", "@iosevka/geometry": "28.0.2"
"spiro": "^3.0.0", }
"typo-geom": "^0.13.1"
}
} }