code/tamagui.dev/data/docs/intro/benchmarks.mdx
Tamagui compares well to the fastest libraries at runtime, and the compiler further optimizes your styled components, flattening them down and hoisting objects out of your rendering loop (and extracting CSS on the web).
With the compiler on Tamagui will output near optimal React code despite giving many nice shorthand style props. It has a higher impact on web, but with initial support for flattening more dynamic styled components now landed, Tamagui does flatten a very high % of your code on all platforms. We look forward to updating our benchmarks as we expect we've improved in a number of areas.
It's important to note that benchmarks never show a complete picture. Our plan is to build out a better benchmarking setup to update this page.
In this benchmark Tamagui is within 10% of the speed of vanilla React Native, even when using nearly all of Tamagui's features. We render list of 28 items with a few sections, text and images. Average of 5 runs on a Apple M2 Air:
<BenchmarkChartNative />Running Tamagui without the compiler averages 125ms or ~12% slower. Note that
the compiler is much more effective on the web as it turns many more props into
CSS and both bundle size and render performance are more important.
We forked and ran a few more benchmarks for the web.
Legend: RNW = react-native-web, SC = styled-components
Timing rendering a simple custom component.
<BenchmarkChart data={[ { name: 'Tamagui', value: 0.018 }, { name: 'RNW', value: 0.057 }, { name: 'Dripsy', value: 0.042 }, { name: 'Stitches', value: 0.023 }, { name: 'Emotion', value: 0.041 }, ]} />
Changing variants is fast at runtime, and even faster when compiled:
<BenchmarkChart data={[ { name: 'Tamagui', value: 0.02 }, { name: 'RNW', value: 0.063 }, { name: 'Dripsy', value: 0.108 }, { name: 'Stitches', value: 0.037 }, { name: 'Emotion', value: 0.069 }, { name: 'SC', value: 0.081 }, ]} />
Since styled-components and Emotion don't offer a first-class variant API, this was done via prop interpolation.
Tamagui has a big advantage for inline styles, it's the only library to compile them and flatten the tree.
<BenchmarkChart data={[ { name: 'Tamagui', value: 0.025 }, { name: 'RNW', value: 0.06 }, { name: 'Dripsy', value: 0.266 }, { name: 'Stitches', value: 0.027 }, { name: 'Emotion', value: 0.047 }, ]} />
These benchmarks don't benefit from the compiler. The React Native API surface is much more feature-rich than DOM.
<BenchmarkChart data={[ { name: 'Tamagui', value: 31.0 }, { name: 'Dripsy', value: 57.5 }, { name: 'Stitches', value: 14.5 }, { name: 'Emotion', value: 49.01 }, ]} />
Note: This test was taken from the styled-components benchmarks.
In this test, we mount a tree with many nested nodes.
<BenchmarkChart data={[ { name: 'Tamagui', value: 18.61 }, { name: 'Dripsy', value: 44.43 }, { name: 'Stitches', value: 8.32 }, { name: 'Emotion', value: 42.49 }, { name: 'SC', value: 51.4 }, ]} />
Note: This test was taken from the styled-components benchmarks.