cssinjs / styled-jss

Styled Components on top of JSS.
http://cssinjs.org/styled-jss
MIT License
217 stars 25 forks source link

Improve mount performance by bulk attachment #9

Closed lttb closed 7 years ago

lttb commented 7 years ago

We have some overhead on detach and attach().link() each mount, so when we have a lot of components that we need to mount at the same time (like https://github.com/A-gambit/CSS-IN-JS-Benchmarks), there some issues.

This fix make significant performance improvement by bulk updating (more then 20x in example above).

TODO:

kof commented 7 years ago

Tests should implement a mock if they need it.

lttb commented 7 years ago

Tests should implement a mock if they need it.

you are right, but the main point is ssr :)

kof commented 7 years ago

mock it for ssr or don't use it when on the server

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-4.2%) to 86.047% when pulling 625e8eded421ce5c7502046fb7a4f5e9e22884d2 on feature/improve-mount-performance into 8fbe4f9925d1a623c9166336fe547cca14cccddd on master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-5.7%) to 84.615% when pulling d1e7818452356fb8d7d9580d0840d9bce2c67e50 on feature/improve-mount-performance into 8fbe4f9925d1a623c9166336fe547cca14cccddd on master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.3%) to 91.579% when pulling 8f9005da41ed2ea0f44e64c48429044845a9d567 on feature/improve-mount-performance into 8fbe4f9925d1a623c9166336fe547cca14cccddd on master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+1.7%) to 92.0% when pulling 6c9c36a4f4abcd35e0d4afda6f1ed8fb8f72507b on feature/improve-mount-performance into 8fbe4f9925d1a623c9166336fe547cca14cccddd on master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+2.9%) to 93.137% when pulling 972d1026da82a7fdcf41f159c9af3b5f5545b280 on feature/improve-mount-performance into 8fbe4f9925d1a623c9166336fe547cca14cccddd on master.

lttb commented 7 years ago

The main problem of this fix is async styles attaching, that may cause FUC (flash of unstyled content). So we can return to this later.

Problem with mount performance solved in #12