Flatten when it is safe
Scalar replacement and method devirtualization can remove private allocations and calls. Public objects, observable identity and host-facing contracts constrain these transformations.
Language · compiler · Lilpack
LilScript is a typed, compression-first language. The compiler mangles, reshapes, and scores a complete JavaScript artifact against the codec you pick — gzip, Brotli, or raw size. Lilpack is the Vite-based delivery path: fast reloads, a language server, the usual editor tools.
class Vector {
float x;
float y;
init(float x, float y) {
this.x = x;
this.y = y;
}
float lengthSquared() {
return this.x * this.x + this.y * this.y;
}
}
int[] values = [1, 2, 3, 4];
auto doubled = values.map((int value) => value * 2);
int sum = 0;
for (int i = 0; i < doubled.length; i++) {
sum += doubled[i];
}
Vector vector = new Vector(3.0, 4.0);
if (vector.lengthSquared() == 25.0) {
print(`sum=${sum}`);
}
let c=a=>a.x*a.x+a.y*a.y,
b=[1,2,3,4].map(a=>a*2|0),a=0;
for(let c=0;c<b.length;c=c+1|0)
a=a+(b[c]|0)|0;
c({x:3,y:4})==25&&console.log(`sum=${a}`);
01 · How it gets smaller
LilScript optimizes a typed program before emitting JavaScript, then scores the complete artifact under the chosen compression objective.
Scalar replacement and method devirtualization can remove private allocations and calls. Public objects, observable identity and host-facing contracts constrain these transformations.
The compiler can rename private properties and identifiers, simplify constant tables, and evaluate alternate layouts. Public and external property names retain their JavaScript contract.
objective.codecs selects the measured target. Raw, gzip and Brotli can choose different artifacts. Our comparison rows use an independent compilation for each objective.
02 · Try the libraries
Open the editor, render mathematics, parse Markdown, validate data or animate a page. Each library’s showcase states its supported surface and links its measured bundles.
03 · Library measurements
Raw, gzip-9 and Brotli-11 are separate compiler objectives. Every library reports both its Original JS API (drop-in) build and its LilScript-native (closed-world) variation keeping all library exports live without JS-compat facade ceremony. Every card links the matching original, the generated artifacts, tests and build-time evidence.
Main ESM; fonts and CSS excluded.
Markdown-to-React pipeline; React external.
Parse API; extension-only exports excluded.
Node package root; locale provider external.
Full Motion DOM entry; no React integration.
Browser singleton and jQuery API.
Seven submodules, each compared with PostHog’s own build of the same code; totals of the seven.
Partial editor namespace; CSS and workers excluded.
Production MobX 7 API.
Main class-merging API, including its tables.
Shader-processing subsystem; not the complete engine.
Experimental Solid 2 compatibility, including JavaScript providers.
Converted part of the three r187 main entry; the boundary grows as the port lands.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Portable main-entry API; see the linked dependency boundary.
Sizes cover the boundary stated on each card. External dependencies, fonts, CSS and additional workers are excluded unless explicitly included. These library measurements do not predict a complete application’s download or runtime performance.
04 · Published evidence
Comparison pages include the original version, independently targeted artifacts, exact byte counts, test coverage and build times. A size result alone does not establish faster execution; runtime results identify their browser and workload.
05 · All published ports
Each column uses the artifact optimized for that column’s objective, showing both the drop-in JS API build and the LilScript-native closed-world variation. Open a library for every minifier lane and its precise API boundary.
| Library and boundary | Raw | gzip-9 | Brotli-11 | Evidence |
|---|---|---|---|---|
| KaTeXMain ESM; fonts and CSS excluded. | 263,473 → 247,701 B−6.0% · Oxc Native: 247,263 B−6.2% vs original | 76,117 → 73,582 B−3.3% · Oxc Native: 73,497 B−3.4% vs original | 62,959 → 61,250 B−2.7% · Terser Native: 61,154 B−2.9% vs original | Files & tests ↗Measured 2026-11-28 |
| react-markdownMarkdown-to-React pipeline; React external. | 146,329 → 108,282 B−26.0% · Terser Native: 108,174 B−26.1% vs original | 46,814 → 42,782 B−8.6% · Terser Native: 42,742 B−8.7% vs original | 41,092 → 36,764 B−10.5% · Terser Native: 36,764 B−10.5% vs original | Files & tests ↗Measured 2026-11-28 |
| MarkedParse API; extension-only exports excluded. | 42,650 → 31,823 B−25.4% · Oxc Native: 31,676 B−25.7% vs original | 12,530 → 9,697 B−22.6% · Oxc Native: 9,688 B−22.7% vs original | 11,488 → 8,808 B−23.3% · Terser Native: 8,780 B−23.6% vs original | Files & tests ↗Measured 2026-11-28 |
| ZodNode package root; locale provider external. | 132,160 → 87,104 B−34.1% · Oxc Native: 84,669 B−35.9% vs original | 35,532 → 31,931 B−10.1% · Oxc Native: 31,615 B−11.0% vs original | 29,956 → 28,760 B−4.0% · Oxc Native: 28,600 B−4.5% vs original | Files & tests ↗Measured 2026-11-28 |
| MotionFull Motion DOM entry; no React integration. | 135,340 → 112,479 B−16.9% · Oxc Native: 103,344 B−23.6% vs original | 45,028 → 40,785 B−9.4% · Terser Native: 38,422 B−14.7% vs original | 40,188 → 36,093 B−10.2% · Terser Native: 34,024 B−15.3% vs original | Files & tests ↗Measured 2026-11-28 |
| jQueryBrowser singleton and jQuery API. | 87,344 → 74,174 B−15.1% · Oxc Native: 74,152 B−15.1% vs original | 30,458 → 28,539 B−6.3% · Terser Native: 28,428 B−6.7% vs original | 27,631 → 25,711 B−6.9% · Terser Native: 25,729 B−6.9% vs original | Files & tests ↗Measured 2026-11-28 |
| PostHogSeven submodules, each compared with PostHog’s own build of the same code; totals of the seven. | 46,660 → 43,673 B−6.4% · smallest upstream per module 7-module showcase | 19,045 → 18,734 B−1.6% · smallest upstream per module 7-module showcase | 17,234 → 16,953 B−1.6% · smallest upstream per module 7-module showcase | Files & tests ↗Measured 2026-10-04 |
| MonacoPartial editor namespace; CSS and workers excluded. | 4,528,715 → 227,756 B−95.0% · Oxc Native: 226,025 B−95.0% vs original | 1,143,993 → 62,103 B−94.6% · Oxc Native: 61,837 B−94.6% vs original | 883,285 → 54,211 B−93.9% · Terser Native: 53,948 B−93.9% vs original | Files & tests ↗Measured 2026-11-28 |
| MobXProduction MobX 7 API. | 51,334 → 45,286 B−11.8% · Oxc Native: 43,435 B−15.4% vs original | 14,705 → 14,478 B−1.5% · Oxc Native: 14,053 B−4.4% vs original | 13,342 → 13,285 B−0.4% · Oxc Native: 12,868 B−3.6% vs original | Files & tests ↗Measured 2026-11-28 |
| cnMain class-merging API, including its tables. | 26,617 → 26,419 B−0.7% · Oxc Native: 26,381 B−0.9% vs original | 10,493 → 10,420 B−0.7% · Oxc Native: 10,397 B−0.9% vs original | 9,288 → 9,262 B−0.3% · Oxc Native: 9,198 B−1.0% vs original | Files & tests ↗Measured 2026-11-28 |
| PlayCanvasShader-processing subsystem; not the complete engine. | 46,667 → 40,573 B−13.1% · Terser Native: 37,602 B−19.4% vs original | 14,012 → 13,652 B−2.6% · Terser Native: 12,892 B−8.0% vs original | 12,522 → 12,349 B−1.4% · Terser Native: 11,627 B−7.1% vs original | Files & tests ↗Measured 2026-11-28 |
| Solid compatibility runtimeExperimental Solid 2 compatibility, including JavaScript providers. | 76,862 → 33,731 B−56.1% · Oxc Native: 32,031 B−58.3% vs original | 27,284 → 9,596 B−64.8% · Oxc Native: 9,330 B−65.8% vs original | 24,632 → 8,648 B−64.9% · Terser Native: 8,496 B−65.5% vs original | Files & tests ↗Measured 2026-11-28 |
| Three.jsConverted part of the three r187 main entry; the boundary grows as the port lands. | 565,186 → 575,369 B+1.8% · Oxc Native: 565,464 B+0.0% vs original | 136,496 → 147,298 B+7.9% · Oxc Native: 144,447 B+5.8% vs original | 110,765 → 121,426 B+9.6% · Oxc Native: 119,067 B+7.5% vs original | Files & tests ↗Measured 2026-12-01 |
| rehypePortable main-entry API; see the linked dependency boundary. | 218,304 → 158,518 B−27.4% · Oxc Native: 158,264 B−27.5% vs original | 67,636 → 56,585 B−16.3% · Terser Native: 56,530 B−16.4% vs original | 54,909 → 47,911 B−12.7% · Terser Native: 47,831 B−12.9% vs original | Files & tests ↗Measured 2026-11-28 |
| remarkPortable main-entry API; see the linked dependency boundary. | 118,946 → 97,377 B−18.1% · Terser Native: 96,888 B−18.5% vs original | 37,039 → 36,918 B−0.3% · Terser Native: 37,001 B−0.1% vs original | 32,318 → 31,976 B−1.1% · Terser Native: 31,997 B−1.0% vs original | Files & tests ↗Measured 2026-11-28 |
| micromarkPortable main-entry API; see the linked dependency boundary. | 81,809 → 64,092 B−21.7% · Terser Native: 63,997 B−21.8% vs original | 26,621 → 26,051 B−2.1% · Terser Native: 26,018 B−2.3% vs original | 23,008 → 22,133 B−3.8% · Terser Native: 22,105 B−3.9% vs original | Files & tests ↗Measured 2026-11-28 |
| mdast-util-from-markdownPortable main-entry API; see the linked dependency boundary. | 84,774 → 68,253 B−19.5% · Terser Native: 68,171 B−19.6% vs original | 27,170 → 26,326 B−3.1% · Terser Native: 26,320 B−3.1% vs original | 23,436 → 22,328 B−4.7% · Terser Native: 22,368 B−4.6% vs original | Files & tests ↗Measured 2026-11-28 |
| remark-parsePortable main-entry API; see the linked dependency boundary. | 84,959 → 64,776 B−23.8% · Terser Native: 64,784 B−23.7% vs original | 27,233 → 26,460 B−2.8% · Terser Native: 26,385 B−3.1% vs original | 23,499 → 22,453 B−4.5% · Terser Native: 22,441 B−4.5% vs original | Files & tests ↗Measured 2026-11-28 |
| unifiedPortable main-entry API; see the linked dependency boundary. | 14,375 → 11,667 B−18.8% · Oxc Native: 11,648 B−19.0% vs original | 5,264 → 4,456 B−15.3% · Oxc Native: 4,438 B−15.7% vs original | 4,791 → 4,045 B−15.6% · Terser Native: 4,038 B−15.7% vs original | Files & tests ↗Measured 2026-11-28 |
| mdast-util-to-hastPortable main-entry API; see the linked dependency boundary. | 16,904 → 13,834 B−18.2% · Terser Native: 13,751 B−18.7% vs original | 5,472 → 5,395 B−1.4% · Terser Native: 5,376 B−1.8% vs original | 4,947 → 4,917 B−0.6% · Terser Native: 4,880 B−1.4% vs original | Files & tests ↗Measured 2026-11-28 |
| remark-rehypePortable main-entry API; see the linked dependency boundary. | 17,050 → 14,046 B−17.6% · Terser Native: 13,960 B−18.1% vs original | 5,527 → 5,481 B−0.8% · Terser Native: 5,463 B−1.2% vs original | 4,998 → 4,971 B−0.5% · Terser Native: 4,961 B−0.7% vs original | Files & tests ↗Measured 2026-11-28 |
| rehype-katexPortable main-entry API; see the linked dependency boundary. | 1,246 → 1,218 B−2.2% · Oxc Native: 1,219 B−2.2% vs original | 700 → 689 B−1.6% · Oxc Native: 687 B−1.9% vs original | 613 → 590 B−3.8% · Oxc Native: 595 B−2.9% vs original | Files & tests ↗Measured 2026-11-28 |
| hast-util-to-htmlPortable main-entry API; see the linked dependency boundary. | 31,627 → 28,330 B−10.4% · Oxc Native: 28,336 B−10.4% vs original | 11,217 → 9,389 B−16.3% · esbuild Native: 9,398 B−16.2% vs original | 9,833 → 8,311 B−15.5% · Terser Native: 8,228 B−16.3% vs original | Files & tests ↗Measured 2026-11-28 |
| rehype-stringifyPortable main-entry API; see the linked dependency boundary. | 31,728 → 28,731 B−9.4% · Oxc Native: 28,568 B−10.0% vs original | 11,255 → 9,398 B−16.5% · Terser Native: 9,515 B−15.5% vs original | 9,875 → 8,433 B−14.6% · Terser Native: 8,417 B−14.8% vs original | Files & tests ↗Measured 2026-11-28 |
| remark-gfmPortable main-entry API; see the linked dependency boundary. | 41,973 → 31,149 B−25.8% · Oxc Native: 28,663 B−31.7% vs original | 12,380 → 11,286 B−8.8% · Terser Native: 11,147 B−10.0% vs original | 11,178 → 10,070 B−9.9% · Terser Native: 9,956 B−10.9% vs original | Files & tests ↗Measured 2026-11-28 |
| remark-breaksPortable main-entry API; see the linked dependency boundary. | 2,988 → 2,566 B−14.1% · Terser Native: 2,529 B−15.4% vs original | 1,284 → 1,186 B−7.6% · Terser Native: 1,185 B−7.7% vs original | 1,173 → 1,074 B−8.4% · Terser Native: 1,073 B−8.5% vs original | Files & tests ↗Measured 2026-11-28 |
| remark-mathPortable main-entry API; see the linked dependency boundary. | 6,112 → 5,282 B−13.6% · Oxc Native: 5,283 B−13.6% vs original | 2,265 → 2,229 B−1.6% · Oxc Native: 2,229 B−1.6% vs original | 2,041 → 2,021 B−1.0% · Oxc Native: 2,022 B−0.9% vs original | Files & tests ↗Measured 2026-11-28 |
06 · Tooling
Closure’s Advanced mode is the closest ancestor. The Java stack around it is slow and awkward for everyday web work. LilScript is being built so reload, analysis, and editor support sit on par with the rest of the ecosystem.
lilpack dev turns expensive search off and keeps HMR
honest. Production uses the project lilscript.toml.
lilscript-lsp and the repo extension: highlight,
diagnostics, completion, hover, rename, format.
Codec, priority, mangling, inlining, layouts, chunks. The language page walks the ones that change behavior.
07 · Read the scope
Full-library, selected-API and compatibility-runtime results answer different questions. Check the linked API boundary, external dependencies and test coverage before choosing a package. Compiler transformations can reduce transfer size while making a workload slower; measure the workload that matters to your application.