Performance & benchmarks
Vajra UI resolves design tokens at runtime, so you get bg="primary" and live theme switching
with no compiler or build step. This page shows what that costs against the other React Native
styling libraries, measured in one run with every library rendering the same card.
Every card changes variant, 12 times · median ms for 100 cards · lower is faster
- StyleSheet (hand-written)95 ms
- Vajra UI 3.0.0103 ms
- twrnc 4.16106 ms
- styled-components 6.6122.5 ms
- NativeWind 4.2257 ms
- Tamagui 3.1, runtime422.5 ms
- Tamagui 3.1, compiled445.5 ms
Results
Median ms for 100 cards (a title, a status dot, a description and two buttons). The switch scenarios are the total of 12 updates. Lower is faster.
| Library | Mount | Variant switch | Theme switch | Theme + variant |
|---|---|---|---|---|
| StyleSheet (hand-written baseline) | 12 | 95 | 91 | 93 |
| twrnc 4.16.0 | 13 | 106 | 97 | 99.5 |
| Vajra UI 3.0.0 | 17 | 103 | 121.5 | 134.5 |
| styled-components 6.6.0 | 15 | 122.5 | 107 | 124 |
| NativeWind 4.2.7 | 30 | 257 | 279.5 | 287 |
| Tamagui 3.1.2, compiled | 60 | 445.5 | 626.5 | 1,071 |
| Tamagui 3.1.2, runtime only | 68 | 422.5 | 764 | 1,188.5 |
What this means:
- Variant switching, the most common interaction, runs at hand-written speed. Vajra is level
with twrnc and within 8% of a hand-written
StyleSheetthat precomputes every style. It is 16% faster than styled-components. - 2.1–2.5× faster than NativeWind on every update, and 1.8× faster to mount.
- 4–8× faster than Tamagui, measured with Tamagui's compiler on.
- Theme switching is where Vajra trails the fastest libraries. It is 14% behind
styled-components, 25% behind twrnc and 34% behind StyleSheet, and further behind with theme
and variant at once. Every
Box,TextandPressablefollows the theme on its own, so a theme change re-renders each of them. In twrnc only the card re-renders.
- This is a stress test. Each trial re-styles 100 cards 12 times. A real screen changes a few dozen elements per interaction, so any of the top four libraries handles one change in well under a frame.
- The numbers are relative, not absolute. They come from React's development build on a desktop CPU. A release build on a phone has different absolute times. An earlier release-build run on the iOS simulator and Android emulator ranked the libraries the same way.
- The gap matters most in long lists and on low-end Android phones, where JavaScript time per frame is scarce. That is where NativeWind's and Tamagui's 2–8× costs become visible.
Per-update latency
The same run, timed per single update: the median shows the typical update, p95 the slowest 1 in 20. Every library made 600 updates per scenario. Timings are whole milliseconds.
| Library | Variant switch, median / p95 | Theme switch, median / p95 | Theme + variant, median / p95 |
|---|---|---|---|
| StyleSheet | 7 / 26 | 7 / 11 | 7 / 12 |
| twrnc | 8 / 27 | 8 / 26 | 8 / 12 |
| Vajra UI 3.0.0 | 8 / 18 | 9 / 28 | 11 / 21 |
| styled-components | 10 / 16 | 8 / 16 | 10 / 24 |
| NativeWind | 19 / 44 | 22 / 60 | 22 / 61 |
| Tamagui, compiled | 33 / 58 | 46 / 79 | 81 / 133 |
| Tamagui, runtime only | 33 / 57 | 54 / 87 | 89 / 143 |
- Vajra's variant switches have a short tail. Its slowest updates take 18 ms, about a third less than StyleSheet's and twrnc's 26–27 ms.
- Theme switches have a longer tail. Vajra's p95 is 28 ms, against 11 ms for StyleSheet and 16 ms for styled-components.
- A frame is 16.7 ms at 60 Hz, 8.3 ms at 120 Hz. An update that takes longer drops a frame.
- Variant switches are the everyday case: a tab, a toggle, a selected item. In this test, Vajra's slow updates of a 100-card list (p95 18 ms) are about a third shorter than StyleSheet's and twrnc's (26–27 ms). Read it as a ratio, since device times differ.
- Theme switches are rare, usually one tap in settings. Vajra's 28 ms tail there means at most one or two dropped frames at the moment the user switches to dark mode.
Mount time and memory
One render of 100 cards. Memory is the JavaScript heap retained after the mount, measured after garbage collection.
| Library | Median | p95 | JS heap |
|---|---|---|---|
| StyleSheet | 12 ms | 35 ms | 4.7 MB |
| twrnc | 13 ms | 35 ms | 4.7 MB |
| Vajra UI 3.0.0 | 17 ms | 28 ms | 5.8 MB |
| styled-components | 15 ms | 17 ms | 6.2 MB |
| NativeWind | 30 ms | 31 ms | 11.8 MB |
| Tamagui, compiled | 60 ms | 228 ms | 14.9 MB |
| Tamagui, runtime only | 68 ms | 113 ms | 16.5 MB |
Vajra mounts 4–5 ms behind StyleSheet and twrnc at the median, but its slowest mounts are faster (28 ms against 35 ms). It uses about 1 MB more memory than StyleSheet for 100 cards, and half what NativeWind uses.
- Mount cost is paid once, when a screen opens. A
FlatListrenders about 10–20 rows at first, so the 5 ms gap per 100 cards to StyleSheet comes to about 1 ms on a typical screen. - Memory differences under 2 MB per 100 cards don't matter on a modern phone. NativeWind and Tamagui use 2–3× Vajra's memory, which adds up in long lists kept mounted, such as feeds and chats.
Re-render work
How much each update touches. A host node counts when React hands React Native a new props object for it. Each update of 100 cards can touch up to 1,001 host nodes.
| Library | Host nodes updated per variant switch | Host nodes updated per theme switch | Commits per update | Unrelated parent re-render |
|---|---|---|---|---|
| StyleSheet | 1,001 | 1,001 | 1 | 1 node, under 1 ms |
| twrnc | 1,001 | 1,001 | 1 | 1 node, under 1 ms |
| Vajra UI 3.0.0 | 601 | 1,001 | 1 | 1 node, under 1 ms |
| styled-components | 1,001 | 1,001 | 1 | 1 node, under 1 ms |
| NativeWind | 1,001 | 1,001 | 1 | 1 node, under 1 ms |
| Tamagui, compiled | 601 | 1,001 | 2 on theme changes | 1 node, under 1 ms |
| Tamagui, runtime only | 601 | 1,001 | 2 on theme changes | 1 node, under 1 ms |
- A variant switch updates 40% fewer host nodes in Vajra. Styles are cached by the tokens you pass, so an element whose style didn't change, like the description text, keeps the same props object, and React Native has nothing to update.
- One commit per update. Tamagui needs two on theme changes.
- A parent re-render that changes nothing costs nothing. Every library re-renders only the element that changed.
- Fewer host-node updates means less native work. Every host node with new props goes through React Native's diff and commit on the native side, which these JavaScript timings don't include. Vajra's 40% fewer updates on variant switches save work there too.
- Unrelated re-renders are free in every library as long as components get stable props. Pass memoized callbacks and objects to keep it that way.
How it was measured
- Same card, same output. Each library renders one
BenchmarkCard100 times. A parity suite checks that every library renders the same host tree, styles, copy and accessibility labels for 3 variants × 2 themes, and that presses reach the right handler. - Each library used as documented. NativeWind's Tailwind CSS is compiled once, as Metro would,
outside the timed window. twrnc builds class strings with
tw.style(). styled-components usesThemeProviderand transient props. Tamagui is measured twice: on its runtime path, and compiled by its own compiler through@tamagui/metro-plugin. - One run, shuffled. 5 rounds, each library in its own Jest process, in a seeded random order per round. 50 trials and 600 updates per library per scenario.
- Statistics. Medians with 95% bootstrap confidence intervals. A difference counts only when the interval excludes zero and the change is at least 5%.
- Choices that favor someone are disclosed. The StyleSheet baseline precomputes all 6 theme ×
variant style sets. Vajra's card computes its
createRecipeoutput once at load. Theme tokens are still resolved at render time.
These are JavaScript-side timings under Jest (Apple M4, Node 24, React 19.2, React Native 0.84), not frame times on a phone. They include React render and commit, not native layout or drawing. An earlier Release build on the iOS simulator and Android emulator ranked the libraries the same way.
The harness, every library's card, the raw samples and the full method, including what could have
biased the numbers, are in
benchmarks/styling/. Start with
RESULTS.md.
- Run it yourself. The harness, every library's card, the raw samples and the statistics are in the repository. Absolute times depend on the machine. The ranking in one run is what should hold.
- The Vajra team wrote every library's card. Parity proves they all render the same thing, not that each one is the fastest way to write it. Improvements from each library's maintainers are welcome.
- Not measured yet: release builds on physical phones,
FlatListscrolling, bundle size and Unistyles, which needs its native runtime.
Does it scale?
How the cost per node holds up as trees grow, measured on @88khp/vajra-ui 3.0.0 and
@88khp/vajra-core 3.0.0. Both packages' Box render React Native's View directly with core's
cached style builder; vajra-ui's Box also resolves theme tokens (p="s-2" rounded="r-1" bg="surface"). The benchmark mounts 100 to 20,000 sibling nodes of each, plus a raw View, and
takes the median of 20 runs after a warm-up.
Total mount time
Median total mount time (ms) — grows with tree size because there's more work overall.
Overhead per node vs Raw View
Flat at 2–3 µs per node up to 10,000 nodes. At 20,000 it rises to 6 µs for the token-aware Box, where a raw View's own cost per node grows too.
Tree size = number of sibling nodes mounted at once · hover or focus a bar for the exact value · light-mode palette
| Tree size | Raw View | vajra-core Box | vajra-ui Box | vajra-ui Box overhead vs View |
|---|---|---|---|---|
| 100 | 1.0 ms | 1.0 ms | 1.0 ms | +0 ms, 0 µs per node |
| 1,000 | 6.0 ms | 8.0 ms | 8.0 ms | +2 ms, 2.0 µs per node |
| 5,000 | 34.0 ms | 47.0 ms | 47.5 ms | +13.5 ms, 2.7 µs per node |
| 10,000 | 69.5 ms | 98.0 ms | 99.5 ms | +30 ms, 3.0 µs per node |
| 20,000 | 162.0 ms | 221.5 ms | 282.0 ms | +120 ms, 6.0 µs per node |
- Flat from 1,000 to 10,000 nodes. The token-aware
Boxcosts 2–3 µs per node over a rawView, the same as the headlessBox: resolving theme tokens is effectively free once styles are cached. - At 20,000 nodes the overhead rises to 5–6 µs per node (6.0 and 5.2 µs in two runs). A raw
View's own cost per node grows there too, from 7.0 to 8.1 µs, as the heap gets large. No real screen mounts 20,000 nodes at once; it is a stress ceiling. - In practice: a dense screen with 300 styled nodes spends under 1 ms on the token layer, once, at mount.
- Real screens mount hundreds of nodes, not tens of thousands.
FlatListvirtualizes long lists, so even a feed of thousands of items mounts only the rows on screen. - Up to 10,000 nodes the token layer costs a flat 2–3 µs per node, the same as the headless
Box. A screen with 300 styled nodes spends under 1 ms on it. - 20,000 nodes is a stress ceiling. The overhead doubles there, but no real screen gets there.
Reproduce it from the repository root:
npx jest --config jest.config.js --testMatch '<rootDir>/scripts/*.bench.tsx' --verbose