Allows the user to test various configurations with the Lightning JS project. Similar to https://github.com/krausest/js-framework-benchmark the Lightning JS benchmark will execute a series of operations to measure the throughput of the framework.
For the official results please see https://lightning-js.github.io/benchmark/
The following operations will be executed:
- Create 1,000 rows (5 warmup runs)
- Update all 1,000 rows (5 warmup runs)
- Partial update, update every 10th row for 1,000 rows (3 warmup runs)
- Select row, change color of a selected row (5 warmup runs)
- Swap row, swap 2 rows for a table with 1,000 rows (5 warmup runs)
- Remove row, remove 1 row (5 warm up runs)
- Create many rows, create 10,000 rows (5 warmup runs)
- Append rows to large table, appending 1,000 rows to a table of 1,000 rows (5 warmup runs)
- Cold startup, load the app and render 1,000 rows to the first frame (7 cold loads, fresh browser context per run, 6x CPU slowdown applied before navigation so JS fetch/parse is included; reported separately from the throughput average)
To run only the startup benchmark (skips the throughput and memory benchmarks, useful for validating startup functionality), serve dist/ and pass the flag directly to the runner:
npx http-server -c-1 ./dist/ (terminal 1)
node index.js --startup-only (terminal 2, combine with --results to also copy to official_results/)
Tune the number of cold loads per framework with STARTUP_RUNS (default 7) and force headless Chromium with HEADLESS=true.
Rectangle rendering is included automatically in the full benchmark run
(npm start and npm run start:official). Each framework completes its
throughput, memory, startup, bundle, and rectangle tests before the runner moves
to the next framework. A rectangle FPS section is added to the same HTML
results overview. Official HTML copies
include the FPS, failures, and expandable raw diagnostics. Rectangle FPS is
reported separately and does not change the duration-based weighted score.
--startup-only skips rectangle rendering.
The rectangle benchmark measures steady-state FPS while 4,000, 8,000, and
16,000 seeded, mixed-size rectangles with a 1px black border and white fill
move through a 1000x540 drawing area in a 1280x720 viewport. The moving-
rectangles scene is inspired by the slaylines canvas-engines comparison
(https://github.com/slaylines/canvas-engines-comparison,
https://benchmarks.slaylines.io), which moves up to a million rectangles on
a canvas; like that comparison we also record an FPSMeter-style smoothed rate
(meterFps, smoothing factor 10) next to the raw callback FPS. Each count is
run as an independent slice with the
same generated positions and per-frame horizontal movement for every enabled
framework. FPS counts each framework's render-frame/tick callback, not browser
requestAnimationFrame callbacks. Each count has a 1-second warmup followed by
three 1.5-second FPS samples. Like the other benchmarks, each slice applies
6x CPU throttling before navigation (recorded as cpuThrottlingRate: 6). Results are saved as
results/rectangles_<timestamp>.json and printed as a table. All framework
directories enabled in .env and included in dist/ are tested.
Both L2 variants also run an independent RAF counter over each FPS sample's
exact time window. The JSON includes rafFps and rafChecks (frame-event count,
RAF count, elapsed time, and both rates) to cross-check the frameStart counter.
The RAF observer does not move the scene or perform rendering.
Average FPS is not a smoothness or presented-frame guarantee. measurements
also record meterFps using the comparison's FPSMeter interval-smoothing formula
(factor 10), plus framePacing with median/p95/p99/max callback intervals and
counts of gaps over 25ms and 50ms. Slow frames can be visible even if average FPS
is close to 60. Neither counter waits for GPU completion or measures display
presentation; the comparison's FPSMeter has the same limitation.
Blits constructs one native-border Element per square in a stable keyed list,
then updates cached Elements with set('x', ...), without triggering the entire
list each frame. This deliberately measures Blits' Element API, not list
reconciliation. This follows the documented loop refs
and border attribute.
sceneValidation verifies that node count and identities stay constant during
movement, outside the timed samples.
The generated scene and drawing area must have the same dimensions: generating
a larger scene causes offscreen culling and misleadingly high FPS. Scene bounds
and count replacement are covered by node --test tests/rectangleBenchmark.test.js.
Each framework runs in its own browser process. A page error, renderer crash, or
timeout is recorded as a failure and does not stop the remaining frameworks;
each framework/count slice uses a fresh browser process, with a default timeout
of 10 minutes (RECTANGLE_TIMEOUT_MS). A crash at one count does not stop the
other counts or frameworks.
Per-count results are saved as soon as each slice finishes. A failed count is
recorded as 0 FPS with its error, while completed earlier counts are retained.
The default counts stop at 16,000 because both Lightning 2 variants and both
L3 renderer variants (renderer, renderer-local) reject counts above
16,000 before creating elements (16-bit quad indices wrap past 16,384 slots).
If higher counts are configured via RECTANGLE_COUNTS, those slices are
reported as unsupported failures (0 FPS).
Build the enabled frameworks and serve dist/ in one terminal:
npm run build
npx http-server -c-1 ./dist/Then run the full suite in another terminal:
node index.jsFor focused troubleshooting, npm run rectangles (or node index.js --rectangles) still runs only the rectangle suite and saves its raw JSON.
Set HEADLESS=true to run Chromium headlessly. For representative performance
results, use the same browser, viewport, display scaling and hardware across
runs; browser refresh-rate limits can cap the reported FPS. The runner also
accepts RECTANGLE_FRAMEWORKS=ftl,renderer to select a subset and
RECTANGLE_COUNTS=8000,16000 to select counts. RECTANGLE_WARMUP_MS,
RECTANGLE_SAMPLE_MS, and RECTANGLE_SAMPLES adjust the sample timings (use
short values for a smoke test, not for comparable performance results).
Two reasons:
- LightningJS is a WebGL framework,
js-framework-benchmarktests for DOM elements - We want to run this on a TV
The baseline is the direct renderer API against which we will compare Application Development frameworks
Clone the repository:
git clone <repo>
Setup the framework:
npm run setup
This should install the dependencies, build the frameworks and copy the frameworks to the dist folder.
If this is the first time that you are using PlayWright (https://playwright.dev/) please make sure you install the PlayWright dependencies by running:
npm run setup:playwright
You can also run individual commands by doing:
npm run build:<x>
To build a framework or if you want to copy the files:
npm run copy:<x>
As of v0.0.2 the Lightning Benchmark implements weighted mean results for different operations. Not all operations are equal when executed, certain framework operations hold a higher weight in terms of measurable impact. The weights used as similar to https://github.com/krausest/js-framework-benchmark/wiki/Computation-of-the-weighted-geometric-mean and are setup as follows:
| test | weight |
|---|---|
| create | 0.64 |
| update | 0.56 |
| skipNth | 0.56 |
| select | 0.19 |
| swap | 0.13 |
| remove | 0.53 |
| createLots | 0.56 |
| append | 0.55 |
| clear | 0.42 |