Benchmarks
These measurements describe the current implementations, not their final performance potential; several known optimization opportunities have not yet been implemented.
These results compare complete public JavaScript layout transactions in Node.js. Every scenario runs through @taffyjs/node, @taffyjs/wasm, @taffyjs/yoga, @taffyjs/yoga-wasm, and yoga-layout. The two public API shapes use explicit implementations of the same semantic workload, including their real tree construction, conversion, layout, output-read, callback, and lifecycle costs.
Each scenario asks a different question and stands on its own. Relative throughput uses yoga-layout as the 1.00× reference. Results from different scenarios are not combined into an overall score or winner.
The publication profile uses 1 isolated round per target. Each round must stay at or below 30% relative margin of error.
Small nested UI: 50 nodes
What does a complete 50-node nested layout transaction cost?
A deterministic near-balanced hierarchy alternates row and column Flexbox containers. It represents nested application UI while keeping the topology identical for every package and API.
Timed transaction
Create the public tree, apply styles, attach every child, calculate layout, read left/top/width/height for every node, and release resources when the API requires it.
Scale
- node count
- 50
- leaf count
- 25
- depth
- 7
- maximum branching factor
- 2
- viewport width
- 1,200
- viewport height
- 800
| Package | API | Runtime | ops/s | Median | vs yoga-layout yoga-layout = 1.00× |
|---|---|---|---|---|---|
@taffyjs/node | TaffyTree | Native Node-API | 1,256.39 | 0.781 ms | 0.524× |
@taffyjs/wasm | TaffyTree | WASI Wasm | 194.17 | 5.043 ms | 0.081× |
@taffyjs/yoga | Yoga Node | Native Taffy | 151.28 | 6.329 ms | 0.063× |
@taffyjs/yoga-wasm | Yoga Node | WASI Taffy | 22.43 | 44.207 ms | 0.009× |
yoga-layout | Yoga Node | Yoga Wasm | 2,399.91 | 0.401 ms | 1.00× |
Nested UI: 500 nodes
What does a complete 500-node nested layout transaction cost?
A deterministic near-balanced hierarchy alternates row and column Flexbox containers. It represents nested application UI while keeping the topology identical for every package and API.
Timed transaction
Create the public tree, apply styles, attach every child, calculate layout, read left/top/width/height for every node, and release resources when the API requires it.
Scale
- node count
- 500
- leaf count
- 250
- depth
- 10
- maximum branching factor
- 2
- viewport width
- 1,200
- viewport height
- 800
| Package | API | Runtime | ops/s | Median | vs yoga-layout yoga-layout = 1.00× |
|---|---|---|---|---|---|
@taffyjs/node | TaffyTree | Native Node-API | 30.77 | 31.895 ms | 0.368× |
@taffyjs/wasm | TaffyTree | WASI Wasm | 12.61 | 77.552 ms | 0.151× |
@taffyjs/yoga | Yoga Node | Native Taffy | 11.46 | 85.727 ms | 0.137× |
@taffyjs/yoga-wasm | Yoga Node | WASI Taffy | 1.95 | 513.400 ms | 0.023× |
yoga-layout | Yoga Node | Yoga Wasm | 83.57 | 11.923 ms | 1.00× |
Wide wrapping collection: 500 items
What does a complete layout transaction cost for one broad wrapping collection?
A two-level Flexbox collection exercises broad child lists, wrapping, repeated style conversion, child attachment, layout reads, and resource release without random fixture generation.
Timed transaction
Create the public root and 500 items, apply styles, attach every item, calculate layout, read left/top/width/height for every node, and release resources when the API requires it.
Scale
- item count
- 500
- node count
- 501
- depth
- 2
- viewport width
- 1,200
| Package | API | Runtime | ops/s | Median | vs yoga-layout yoga-layout = 1.00× |
|---|---|---|---|---|---|
@taffyjs/node | TaffyTree | Native Node-API | 222.77 | 4.310 ms | 0.357× |
@taffyjs/wasm | TaffyTree | WASI Wasm | 30.78 | 31.079 ms | 0.049× |
@taffyjs/yoga | Yoga Node | Native Taffy | 19.94 | 49.487 ms | 0.032× |
@taffyjs/yoga-wasm | Yoga Node | WASI Taffy | 2.60 | 380.510 ms | 0.004× |
yoga-layout | Yoga Node | Yoga Wasm | 623.17 | 1.534 ms | 1.00× |
Coding-agent chat: initial layout
What does it cost to build, measure, lay out, read, and release a modeled coding-agent screen?
A fixed desktop chat fixture contains a session sidebar, measured labels, a message transcript, and a composer. Text callbacks use the same intrinsic-size function and constraints for both public APIs.
Timed transaction
Create the public tree from fixed fixture data, calculate with public text-measure callbacks, read left/top/width/height for every node, and release resources when the API requires it.
Scale
- node count
- 285
- measured node count
- 51
- session count
- 18
- message count
- 32
- viewport width
- 1,280
- viewport height
- 800
| Package | API | Runtime | ops/s | Median | vs yoga-layout yoga-layout = 1.00× |
|---|---|---|---|---|---|
@taffyjs/node | TaffyTree | Native Node-API | 21.32 | 46.212 ms | 0.024× |
@taffyjs/wasm | TaffyTree | WASI Wasm | 2.73 | 363.489 ms | 0.003× |
@taffyjs/yoga | Yoga Node | Native Taffy | 12.18 | 81.655 ms | 0.014× |
@taffyjs/yoga-wasm | Yoga Node | WASI Taffy | 1.61 | 617.934 ms | 0.002× |
yoga-layout | Yoga Node | Yoga Wasm | 901.66 | 1.043 ms | 1.00× |
Coding-agent chat: viewport resize
What does it cost to relayout an existing measured application tree after a resize?
The same coding-agent fixture is created and initially laid out before timing. Each transaction alternates between two fixed viewport sizes, recomputes measured layout, and reads every result.
Timed transaction
Update the persistent root size through the public API, calculate layout with public text-measure callbacks, then read left/top/width/height for every node. Setup and final release are outside timing.
Scale
- node count
- 285
- measured node count
- 51
- session count
- 18
- message count
- 32
- initial viewport width
- 1,280
- initial viewport height
- 800
- resized viewport width
- 1,024
- resized viewport height
- 768
| Package | API | Runtime | ops/s | Median | vs yoga-layout yoga-layout = 1.00× |
|---|---|---|---|---|---|
@taffyjs/node | TaffyTree | Native Node-API | 50.77 | 19.081 ms | 0.013× |
@taffyjs/wasm | TaffyTree | WASI Wasm | 6.33 | 158.681 ms | 0.002× |
@taffyjs/yoga | Yoga Node | Native Taffy | 23.47 | 41.570 ms | 0.006× |
@taffyjs/yoga-wasm | Yoga Node | WASI Taffy | 3.43 | 290.868 ms | 0.001× |
yoga-layout | Yoga Node | Yoga Wasm | 3,980.17 | 0.249 ms | 1.00× |
Run details
- Node.js
- v24.19.0
- Operating system
- linux 6.18.25-x64v3-xanmod1 (x64)
- CPU
- 13th Gen Intel(R) Core(TM) i5-13500H
- Commit
1cbbd1595f536e665f67e0e9757c9ca27fcf8c46