Skip to content

SVB v0.2.0 — repetition, gradients, command runs

Choose a tag to compare

@kinti kinti released this 30 Aug 22:33
· 27 commits to main since this release

Closes the two big gaps from the v0.1.1 review (F-11, F-12).

New in v0.2

  • DEF chunk — repetition as templates + instances: SVG <use> semantics at the binary layer. Repeated shapes are stored once (~1 template) and referenced by translate-only instances (~4-5 B each, delta-chained MVT-style). The 574 KB repetitive map now encodes to 1,725 B raw.
  • GRAD chunk — gradients: linear/radial, objectBoundingBox (u8) or userSpaceOnUse coordinates, optional gradientTransform, per-gradient alpha. A 2-stop OBB linear gradient costs ~16 B (vs ~250 B in SVG).
  • Command-run packing (MVT CommandInteger port): consecutive same-command path segments pack into one varint — kills the measured 12% command-byte cost.
  • Security: INV-13 (flat templates, no cycles by grammar), INV-14 expansion budget ≤ 1M elements (template-bomb guard), strict gradient vocabulary, version-byte 2 discipline. v1 files remain valid.

Benchmarks (corpus 1,087 production SVGs, svgo-optimized): median ×0.277, svb < svgo+brotli on 100% of files; large repetitive files ×0.064-0.233 of SVG. Organic no-repetition class stays at ×1.055 (conceded to v0.3 geometry modeling).

43 tests · MIT · © 2026 Jesús Quintana