Safe by proof
Viscosity only rewrites a collection when no code could notice. Aliasing, escaping elements, unknown callers or non-numeric data mean it leaves your code alone and says why.
Whole JavaScript programs, original vs compiled by Viscosity, on two engines. Longer bars are faster.
ps=soa cells=soa tx=soa fl=soa bs=soa Speed-up = original time / compiled time of each program’s timed section, best of 9 fresh processes on a shared 4-vCPU VM (2026-10-31); checksums matched on every run. Differences under about 10% are noise. Full tables and method →
Safe by proof
Viscosity only rewrites a collection when no code could notice. Aliasing, escaping elements, unknown callers or non-numeric data mean it leaves your code alone and says why.
It explains itself
viscosity explain lists every collection, the layout chosen, which loops touch which fields, and every reason it refused.
Many languages, one engine
JavaScript, TypeScript and a Python subset lower into one language-neutral IR (VIR), and every language shares the same analyses.
// you write:const ps = [];for (let i = 0; i < n; i++) ps.push({ x: i, vx: 1 });for (const p of ps) p.x += p.vx * dt;
// Viscosity emits (abridged):const ps = new __Vsc_ps(); // one Float64Array per fieldfor (let i = 0; i < n; i++) ps.push(i, 1);for (let p = 0; p < ps.length; p++) ps.x[p] += ps.vx[p] * dt;