Three.js r187 · LilScript port · in progress
Three.js,
rewritten.
threelil is Three.js written again in LilScript. Same names, same API, same pictures: you change the import and nothing else. This page shows how it compares with the original today, wins and losses both.
import { Scene, Mesh } from 'three'
import { Scene, Mesh } from 'threelil'
Loading the measurements…
Both sides are measured on the same list of exports. The original is minified with whichever minifier makes it smallest. Lower size and lower time are better.
The short version
Four questions.
Three.js is the most used 3D library on the web. LilScript is a language that compiles to JavaScript. Writing Three.js again in LilScript lets the compiler see the whole library, so it can make it smaller and faster while your code stays the same. Here is where that stands today.
Live · running in your browser
Eight apps,
running now.
Each app is written twice: once with threelil, once with the original three. You are looking at the threelil build. Switch a card to the original, or open the two side by side.
Same picture
Pixel for pixel.
Official Three.js examples are loaded twice, once with the original and once with threelil, and the two screenshots are compared pixel by pixel.
Every example that was compared
Try it yourself
Run the math.
This builds and takes apart 200 matrices with threelil and with the minified original, right here in your browser, and compares every number bit by bit. Change the seed to get different matrices.
Speed · lower time is better
Is it faster?
The same small jobs (vector math, updating a scene, building geometry, loading a model) are timed with the original and with threelil. Both must produce the same result.
Slower than the original in the last run
A row here is a loss. The goal is none.
Every speed test, with times
Drawing on the graphics card
Size · fewer bytes is better
Is it smaller?
How many bytes a browser has to download for the library. Counted three ways: the plain file (raw), and the two ways servers compress it (gzip and Brotli; Brotli is what most sites send).
In a real app
The eight demos compile app code with the parts of ThreeLil they use and import the remaining implementations from upstream Three.js.
Size of each demo app
Where the extra bytes are, by part of the library
When the library is only used from LilScript
How small the original gets with each minifier
For the curious
How it is built.
How long each build takes, and the package that was checked. Every number on this page comes from files you can open: sizes, build commands, speed tests, picture checks.
Build time
The checked package
Same API as three