|
| 1 | +--- |
| 2 | +title: Performance Benchmarks | gluestack-ui |
| 3 | +description: gluestack-ui harnesses the power of NativeWind, a universal and highly performant styling library, to style the components. |
| 4 | +--- |
| 5 | + |
| 6 | +import { Canvas, Meta, Story } from '@storybook/addon-docs'; |
| 7 | +import { Graph } from '../../../extra-components/nativewind/Progress'; |
| 8 | + |
| 9 | +<Meta title="ui/Home/Performance/Benchmarks" /> |
| 10 | + |
| 11 | +# Performance Benchmarks |
| 12 | + |
| 13 | +`gluestack-ui` harnesses the power of [NativeWind](https://www.nativewind.dev/v4/overview), a universal and highly performant styling library, to style the components. |
| 14 | + |
| 15 | +# React Native |
| 16 | + |
| 17 | +We performed the [benchmarks](https://github.com/gluestack/gluestack-ui-benchmarks) with `React Native`, `gluestack-ui v1` and `gluestack-ui v2`. |
| 18 | + |
| 19 | +**In each case we have rendered 1000 components with styling of each library. Results are average of 5 mounts.** |
| 20 | + |
| 21 | +> **All the benchmarks were measured in production environment on iPhone 15.** |
| 22 | +
|
| 23 | +## Simple Component |
| 24 | + |
| 25 | +The time it takes to render a simple themed component. We've developed a Box component using View with some default styles. |
| 26 | + |
| 27 | +<Graph |
| 28 | + data={{ |
| 29 | + 'React Native': 68, |
| 30 | + 'gluestack-ui v1': 132, |
| 31 | + 'gluestack-ui v2': 99, |
| 32 | + }} |
| 33 | +/> |
| 34 | + |
| 35 | +## Component with variants |
| 36 | + |
| 37 | +The time needed to render a component with different variations. We've developed a Box component using View with default styles and multiple variants. |
| 38 | + |
| 39 | +<Graph |
| 40 | + data={{ |
| 41 | + 'React Native': 73, |
| 42 | + 'gluestack-ui v1': 146, |
| 43 | + 'gluestack-ui v2': 144, |
| 44 | + }} |
| 45 | +/> |
| 46 | + |
| 47 | +> Styled Components doesn't have built-in support for variants. We've incorporated prop-based variants into Styled Components. |
| 48 | +
|
| 49 | +## Component with default theme and inline styles |
| 50 | + |
| 51 | +A component with default themes, variations, inline styles, and state styles. We've designed a Button component using Pressable with default style, variations, state style, and inline styles. |
| 52 | + |
| 53 | +<Graph |
| 54 | + data={{ |
| 55 | + 'gluestack-ui v1': 360, |
| 56 | + 'gluestack-ui v2': 241, |
| 57 | + }} |
| 58 | +/> |
| 59 | + |
| 60 | +> React Native doesn't provide out of the box support for state styling. |
| 61 | +
|
| 62 | +## Layout using HStack, VStack, Image and Text |
| 63 | + |
| 64 | +Creating a layout with HStack, VStack, Image, and Text to display a list of 28 items. We've utilized components from the following libraries for this purpose. |
| 65 | + |
| 66 | +<Graph |
| 67 | + data={{ |
| 68 | + 'React Native': 58, |
| 69 | + 'gluestack-ui v1': 89, |
| 70 | + 'gluestack-ui v2': 76, |
| 71 | + }} |
| 72 | +/> |
| 73 | + |
| 74 | +> Note: This test was taken from [Tamagui](https://github.com/tamagui/tamagui/tree/24ac758bbe5d6ff2f67f25071df4286e0594f578/starters/benchmark). |
| 75 | +
|
| 76 | +# Web |
| 77 | + |
| 78 | +We are working on dedicated benchmarks for the web. Stay tuned for more updates! |
| 79 | + |
| 80 | +In the meantime, we've built the landing page for version 2 using `gluestack-ui v2`, achieving a Lighthouse score of 85+. |
0 commit comments