Skip to main content

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

  1. StyleSheet (hand-written)95 ms
  2. Vajra UI 3.0.0103 ms
  3. twrnc 4.16106 ms
  4. styled-components 6.6122.5 ms
  5. NativeWind 4.2257 ms
  6. Tamagui 3.1, runtime422.5 ms
  7. Tamagui 3.1, compiled445.5 ms
JavaScript-side timings under Jest, every library in the same run, each rendering the same card with identical output. Hover a row for its multiple of hand-written StyleSheet.

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.

LibraryMountVariant switchTheme switchTheme + variant
StyleSheet (hand-written baseline)12959193
twrnc 4.16.0131069799.5
Vajra UI 3.0.017103121.5134.5
styled-components 6.6.015122.5107124
NativeWind 4.2.730257279.5287
Tamagui 3.1.2, compiled60445.5626.51,071
Tamagui 3.1.2, runtime only68422.57641,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 StyleSheet that 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, Text and Pressable follows the theme on its own, so a theme change re-renders each of them. In twrnc only the card re-renders.
In a real app
  • 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.

LibraryVariant switch, median / p95Theme switch, median / p95Theme + variant, median / p95
StyleSheet7 / 267 / 117 / 12
twrnc8 / 278 / 268 / 12
Vajra UI 3.0.08 / 189 / 2811 / 21
styled-components10 / 168 / 1610 / 24
NativeWind19 / 4422 / 6022 / 61
Tamagui, compiled33 / 5846 / 7981 / 133
Tamagui, runtime only33 / 5754 / 8789 / 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.
In a real app
  • 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.

LibraryMedianp95JS heap
StyleSheet12 ms35 ms4.7 MB
twrnc13 ms35 ms4.7 MB
Vajra UI 3.0.017 ms28 ms5.8 MB
styled-components15 ms17 ms6.2 MB
NativeWind30 ms31 ms11.8 MB
Tamagui, compiled60 ms228 ms14.9 MB
Tamagui, runtime only68 ms113 ms16.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.

In a real app
  • Mount cost is paid once, when a screen opens. A FlatList renders 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.

LibraryHost nodes updated per variant switchHost nodes updated per theme switchCommits per updateUnrelated parent re-render
StyleSheet1,0011,00111 node, under 1 ms
twrnc1,0011,00111 node, under 1 ms
Vajra UI 3.0.06011,00111 node, under 1 ms
styled-components1,0011,00111 node, under 1 ms
NativeWind1,0011,00111 node, under 1 ms
Tamagui, compiled6011,0012 on theme changes1 node, under 1 ms
Tamagui, runtime only6011,0012 on theme changes1 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.
In a real app
  • 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 BenchmarkCard 100 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 uses ThemeProvider and 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 createRecipe output 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.

Important to know
  • 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, FlatList scrolling, 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

Raw View — react-native
Box — @88khp/vajra-core 3.0.0 (headless)
Box — @88khp/vajra-ui 3.0.0 (theme tokens)
0751502253001001,0005,00010,00020,000

Median total mount time (ms) — grows with tree size because there's more work overall.

Overhead per node vs Raw View

Box — @88khp/vajra-core 3.0.0 (headless)
Box — @88khp/vajra-ui 3.0.0 (theme tokens)
024681001,0005,00010,00020,000

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 sizeRaw Viewvajra-core Boxvajra-ui Boxvajra-ui Box overhead vs View
1001.0 ms1.0 ms1.0 ms+0 ms, 0 µs per node
1,0006.0 ms8.0 ms8.0 ms+2 ms, 2.0 µs per node
5,00034.0 ms47.0 ms47.5 ms+13.5 ms, 2.7 µs per node
10,00069.5 ms98.0 ms99.5 ms+30 ms, 3.0 µs per node
20,000162.0 ms221.5 ms282.0 ms+120 ms, 6.0 µs per node
  • Flat from 1,000 to 10,000 nodes. The token-aware Box costs 2–3 µs per node over a raw View, the same as the headless Box: 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.
In a real app
  • Real screens mount hundreds of nodes, not tens of thousands. FlatList virtualizes 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