๐Ÿ“ฆ michelengelen / css-in-js-benchmark

โ˜… 1 stars โ‘‚ 0 forks ๐Ÿ‘ 1 watching
๐Ÿ“ฅ Clone https://github.com/michelengelen/css-in-js-benchmark.git
HTTPS git clone https://github.com/michelengelen/css-in-js-benchmark.git
SSH git clone git@github.com:michelengelen/css-in-js-benchmark.git
CLI gh repo clone michelengelen/css-in-js-benchmark
Michel Engelen Michel Engelen changed prettier config 9ff13a2 4 years ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .idea
๐Ÿ“ apps
๐Ÿ“ comparison
๐Ÿ“ public
๐Ÿ“ results
๐Ÿ“ scripts
๐Ÿ“ test-suite
๐Ÿ“ utils
๐Ÿ“ webpack-config
๐Ÿ“„ .babelrc
๐Ÿ“„ .eslintignore
๐Ÿ“„ .eslintrc.json
๐Ÿ“„ .gitignore
๐Ÿ“„ .prettierrc
๐Ÿ“„ benchConfig.js
๐Ÿ“„ package-lock.json
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ README.md

css-in-js-benchmark

Command to build all test-apps

npm run build-all

Results from webpack builds


librarybuild timebuild size
emotion-styled4687 ms198.525 KB
react-jss5050 ms226.631 KB
sass4422 ms182.118 KB
styled-components4673 ms209.477 KB
treat5640 ms179.516 KB
typestyle4441 ms186.484 KB

Command To run the complete test-suite

npm run bench-all

Results from Puppeteer Test


FirstMeaningfulPaint

request to /

library1. run2. run3. run4. run5. runaverage
emotion-styled45.29 ms29.55 ms39.48 ms43.46 ms38.61 ms39.28 ms
react-jss53.55 ms57.04 ms59.76 ms55.78 ms55.86 ms56.40 ms
sass49.76 ms55.49 ms48.35 ms47.26 ms62.33 ms52.64 ms
styled-components46.04 ms54.16 ms55.23 ms60.09 ms52.91 ms53.69 ms
treat51.57 ms48.49 ms49.99 ms55.53 ms51.07 ms51.33 ms
typestyle50.06 ms63.52 ms63.42 ms67.19 ms63.17 ms61.47 ms

request to /table

library1. run2. run3. run4. run5. runaverage
emotion-styled220.53 ms214.83 ms223.24 ms210.33 ms220.32 ms217.85 ms
react-jss179.41 ms189.65 ms183.26 ms192.28 ms195.49 ms188.02 ms
sass179.25 ms179.58 ms172.28 ms175.40 ms175.85 ms176.47 ms
styled-components223.56 ms223.05 ms225.78 ms228.22 ms229.61 ms226.04 ms
treat173.51 ms190.44 ms186.60 ms185.79 ms190.57 ms185.38 ms
typestyle276.54 ms296.34 ms288.70 ms291.71 ms281.62 ms286.98 ms

First Meaningful Paint (FMP) is the paint after which the biggest above-the-fold layout change has happened and web fonts have loaded. It is when the answer to "Is it useful?" becomes "yes", upon first meaningful paint completion.


LayoutCount

request to /

library1. run2. run3. run4. run5. run
emotion-styled22221
react-jss22222
sass22222
styled-components22222
treat22222
typestyle33333

request to /table

library1. run2. run3. run4. run5. run
emotion-styled44342
react-jss33344
sass43344
styled-components34333
treat34334
typestyle66565

LayoutDuration

request to /

library1. run2. run3. run4. run5. runaverage
emotion-styled0.36 ms0.34 ms0.39 ms0.36 ms0.30 ms0.35 ms
react-jss0.46 ms0.46 ms0.51 ms0.39 ms0.41 ms0.45 ms
sass0.37 ms0.42 ms0.37 ms0.40 ms0.43 ms0.40 ms
styled-components0.39 ms0.45 ms0.44 ms0.42 ms0.44 ms0.43 ms
treat0.33 ms0.42 ms0.42 ms0.39 ms0.39 ms0.39 ms
typestyle0.40 ms0.46 ms0.44 ms0.56 ms0.44 ms0.46 ms

request to /table

library1. run2. run3. run4. run5. runaverage
emotion-styled68.91 ms60.93 ms68.61 ms60.69 ms64.08 ms64.64 ms
react-jss62.86 ms59.24 ms58.64 ms61.30 ms62.89 ms60.98 ms
sass62.61 ms61.01 ms58.22 ms59.03 ms57.54 ms59.68 ms
styled-components57.58 ms58.29 ms58.28 ms57.12 ms58.15 ms57.88 ms
treat59.22 ms59.29 ms57.37 ms58.85 ms60.55 ms59.06 ms
typestyle131.24 ms137.69 ms130.77 ms133.67 ms127.43 ms132.16 ms

RecalcStyleCount

request to /

library1. run2. run3. run4. run5. run
emotion-styled22221
react-jss22222
sass32332
styled-components33222
treat22222
typestyle33333

request to /table

library1. run2. run3. run4. run5. run
emotion-styled44342
react-jss33344
sass53454
styled-components45333
treat34334
typestyle66565

RecalcStyleDuration

request to /

library1. run2. run3. run4. run5. runaverage
emotion-styled0.34 ms0.30 ms0.33 ms0.32 ms0.22 ms0.30 ms
react-jss0.39 ms0.35 ms0.36 ms0.36 ms0.35 ms0.36 ms
sass0.38 ms0.41 ms0.39 ms0.42 ms0.39 ms0.40 ms
styled-components0.37 ms0.45 ms0.37 ms0.40 ms0.36 ms0.39 ms
treat0.36 ms0.39 ms0.39 ms0.39 ms0.39 ms0.38 ms
typestyle0.36 ms0.42 ms0.39 ms0.52 ms0.40 ms0.42 ms

request to /table

library1. run2. run3. run4. run5. runaverage
emotion-styled37.13 ms32.36 ms34.99 ms32.52 ms32.65 ms33.93 ms
react-jss33.39 ms34.72 ms32.45 ms34.20 ms34.47 ms33.85 ms
sass36.79 ms36.35 ms35.70 ms34.86 ms37.22 ms36.18 ms
styled-components33.42 ms33.66 ms32.71 ms33.90 ms32.58 ms33.25 ms
treat35.78 ms36.22 ms35.90 ms35.19 ms35.59 ms35.74 ms
typestyle62.93 ms64.29 ms61.80 ms62.95 ms60.54 ms62.50 ms

ScriptDuration

request to /

library1. run2. run3. run4. run5. runaverage
emotion-styled5.34 ms5.18 ms5.23 ms5.18 ms5.05 ms5.20 ms
react-jss8.92 ms8.85 ms8.87 ms8.60 ms8.89 ms8.83 ms
sass4.39 ms5.26 ms4.77 ms5.23 ms5.38 ms5.01 ms
styled-components7.25 ms8.26 ms8.28 ms8.49 ms8.55 ms8.17 ms
treat18.93 ms5.09 ms5.01 ms4.97 ms4.91 ms7.78 ms
typestyle20.50 ms24.21 ms23.67 ms24.15 ms23.51 ms23.21 ms

request to /table

library1. run2. run3. run4. run5. runaverage
emotion-styled88.14 ms93.52 ms90.30 ms89.47 ms93.07 ms90.90 ms
react-jss58.78 ms67.53 ms64.51 ms67.53 ms67.71 ms65.21 ms
sass46.03 ms50.04 ms47.77 ms48.80 ms49.94 ms48.51 ms
styled-components102.08 ms103.34 ms106.15 ms107.48 ms109.00 ms105.61 ms
treat64.17 ms60.65 ms60.09 ms59.28 ms59.30 ms60.70 ms
typestyle68.24 ms81.75 ms80.51 ms82.31 ms80.01 ms78.56 ms

TaskDuration

request to /

library1. run2. run3. run4. run5. runaverage
emotion-styled50.68 ms43.13 ms53.26 ms53.68 ms49.80 ms50.11 ms
react-jss35.71 ms35.52 ms36.01 ms35.86 ms37.20 ms36.06 ms
sass38.46 ms34.72 ms29.00 ms32.52 ms34.13 ms33.77 ms
styled-components30.04 ms36.77 ms33.32 ms36.68 ms34.26 ms34.22 ms
treat38.95 ms32.28 ms30.34 ms31.77 ms32.26 ms33.12 ms
typestyle39.49 ms49.94 ms49.49 ms52.26 ms49.44 ms48.13 ms

request to /table

library1. run2. run3. run4. run5. runaverage
emotion-styled265.35 ms250.70 ms269.67 ms257.11 ms262.34 ms261.03 ms
react-jss211.05 ms217.20 ms213.04 ms222.55 ms227.04 ms218.17 ms
sass210.30 ms218.39 ms206.48 ms212.51 ms214.99 ms212.53 ms
styled-components256.59 ms251.63 ms250.41 ms254.20 ms252.93 ms253.15 ms
treat204.48 ms227.79 ms222.64 ms224.10 ms228.93 ms221.59 ms
typestyle321.99 ms338.74 ms328.88 ms336.25 ms322.46 ms329.66 ms

domComplete

request to /

library1. run2. run3. run4. run5. runaverage
emotion-styled75.30 ms52.01 ms46.48 ms49.20 ms49.01 ms54.40 ms
react-jss60.26 ms55.23 ms37.58 ms38.29 ms40.54 ms46.38 ms
sass56.65 ms34.51 ms34.15 ms34.26 ms33.23 ms38.56 ms
styled-components64.15 ms36.99 ms36.70 ms37.46 ms37.34 ms42.53 ms
treat53.69 ms32.63 ms27.45 ms26.75 ms27.07 ms33.52 ms
typestyle50.49 ms25.97 ms27.24 ms26.23 ms26.77 ms31.34 ms

request to /table

library1. run2. run3. run4. run5. runaverage
emotion-styled255.45 ms201.19 ms210.99 ms215.70 ms246.13 ms225.89 ms
react-jss203.28 ms96.63 ms174.06 ms100.39 ms177.38 ms150.35 ms
sass193.21 ms88.31 ms92.50 ms90.63 ms86.45 ms110.22 ms
styled-components243.28 ms219.81 ms219.58 ms223.32 ms216.57 ms224.51 ms
treat197.57 ms171.96 ms93.05 ms94.46 ms94.46 ms130.30 ms
typestyle85.04 ms84.17 ms89.28 ms83.01 ms81.36 ms84.57 ms

The domComplete read-only property returns a timestamp representing the time value equal to the time immediately before the user agent sets the current document readiness of the current document to complete.


domInteractive

request to /

library1. run2. run3. run4. run5. runaverage
emotion-styled62.82 ms50.85 ms45.24 ms47.89 ms47.69 ms50.90 ms
react-jss59.85 ms54.13 ms36.42 ms37.11 ms36.75 ms44.85 ms
sass55.40 ms34.09 ms33.61 ms33.77 ms32.62 ms37.90 ms
styled-components62.80 ms36.59 ms36.30 ms36.90 ms36.88 ms41.90 ms
treat53.38 ms32.36 ms27.07 ms26.29 ms26.58 ms33.14 ms
typestyle50.20 ms25.79 ms27.04 ms26.04 ms26.58 ms31.13 ms

request to /table

library1. run2. run3. run4. run5. runaverage
emotion-styled112.64 ms88.76 ms102.37 ms102.82 ms101.96 ms101.71 ms
react-jss77.08 ms63.64 ms64.83 ms64.10 ms63.37 ms66.61 ms
sass59.05 ms53.75 ms56.82 ms55.87 ms53.41 ms55.78 ms
styled-components118.18 ms107.68 ms110.02 ms111.22 ms108.01 ms111.02 ms
treat70.90 ms62.69 ms59.07 ms60.37 ms59.80 ms62.56 ms
typestyle64.81 ms63.97 ms63.82 ms62.26 ms60.67 ms63.11 ms

The domInteractive read-only property returns a timestamp representing the time value equal to the time immediately before the user agent sets the current document readiness of the current document to interactive.


domContentLoadedEventEnd

request to /

library1. run2. run3. run4. run5. runaverage
emotion-styled62.85 ms50.89 ms45.28 ms47.93 ms47.75 ms50.94 ms
react-jss59.89 ms54.16 ms36.46 ms37.14 ms36.79 ms44.89 ms
sass55.44 ms34.13 ms33.66 ms33.81 ms32.65 ms37.94 ms
styled-components62.84 ms36.63 ms36.33 ms36.97 ms36.94 ms41.94 ms
treat53.41 ms32.40 ms27.11 ms26.32 ms26.61 ms33.17 ms
typestyle50.26 ms25.83 ms27.09 ms26.08 ms26.62 ms31.18 ms

request to /table

library1. run2. run3. run4. run5. runaverage
emotion-styled112.67 ms88.79 ms102.41 ms102.85 ms102.01 ms101.75 ms
react-jss77.12 ms63.67 ms64.86 ms64.13 ms63.40 ms66.64 ms
sass59.06 ms53.78 ms56.88 ms55.90 ms53.44 ms55.81 ms
styled-components118.21 ms107.73 ms110.05 ms111.24 ms108.04 ms111.05 ms
treat70.94 ms62.72 ms59.10 ms60.40 ms59.83 ms62.60 ms
typestyle64.84 ms64.00 ms63.85 ms62.29 ms60.70 ms63.14 ms

The domContentLoadedEventEnd read-only property returns a timestamp representing the time value equal to the time immediately after the current document's DOMContentLoaded event completes.


duration

request to /

library1. run2. run3. run4. run5. runaverage
emotion-styled75.31 ms52.02 ms46.48 ms49.21 ms49.01 ms54.41 ms
react-jss60.26 ms55.23 ms37.59 ms38.30 ms40.56 ms46.39 ms
sass56.65 ms34.52 ms34.17 ms34.27 ms33.23 ms38.57 ms
styled-components64.16 ms37.00 ms36.70 ms37.47 ms37.34 ms42.53 ms
treat53.70 ms32.64 ms27.46 ms26.75 ms27.08 ms33.53 ms
typestyle50.50 ms25.98 ms27.25 ms26.23 ms26.77 ms31.35 ms

request to /table

library1. run2. run3. run4. run5. runaverage
emotion-styled255.45 ms201.19 ms211.00 ms215.71 ms246.13 ms225.90 ms
react-jss203.29 ms96.63 ms174.07 ms100.39 ms177.39 ms150.35 ms
sass193.22 ms88.32 ms92.52 ms90.63 ms86.46 ms110.23 ms
styled-components243.28 ms219.82 ms219.58 ms223.33 ms216.58 ms224.52 ms
treat197.58 ms171.96 ms93.06 ms94.47 ms94.46 ms130.31 ms
typestyle85.04 ms84.17 ms89.28 ms83.01 ms81.37 ms84.58 ms

In this case we are measuring the duration for the navigation performance type. It returns the timestamp that is the difference between the PerformanceNavigationTiming.loadEventEnd and PerformanceEntry.startTime properties, respectively


Results from Express JS Test

Time To Complete 500 consecutive requests


Simple Component

500 requests to /

library1. run2. run3. run4. run5. runaverage
emotion-styled555.00 ms352.00 ms402.00 ms376.00 ms346.00 ms406.20 ms
react-jss458.00 ms396.00 ms317.00 ms379.00 ms346.00 ms379.20 ms
sass446.00 ms384.00 ms317.00 ms344.00 ms390.00 ms376.20 ms
styled-components409.00 ms328.00 ms386.00 ms351.00 ms415.00 ms377.80 ms
treat400.00 ms325.00 ms362.00 ms351.00 ms369.00 ms361.40 ms
typestyle378.00 ms404.00 ms381.00 ms367.00 ms394.00 ms384.80 ms

Long Table Component

500 requests to /table (rendering a table with 500 rows)

library1. run2. run3. run4. run5. runaverage
emotion-styled563.00 ms383.00 ms346.00 ms427.00 ms343.00 ms412.40 ms
react-jss495.00 ms391.00 ms346.00 ms440.00 ms433.00 ms421.00 ms
sass453.00 ms374.00 ms502.00 ms391.00 ms405.00 ms425.00 ms
styled-components434.00 ms362.00 ms403.00 ms396.00 ms381.00 ms395.20 ms
treat427.00 ms361.00 ms383.00 ms361.00 ms380.00 ms382.40 ms
typestyle376.00 ms356.00 ms391.00 ms381.00 ms1311.00 ms563.00 ms

ToDo

  • add sass
  • add @emotion/styled
  • add styled-components
  • add theming tests
  • improved build script
  • add better console output while testing
  • add chalk for coloring console outputs
  • add logging for puppeteer tests

Resources

This repository is based upon the work done here xteamcssinjs