styled-components / babel-plugin-styled-components

Improve the debugging experience and add server-side rendering support to styled-components
MIT License
1.07k stars 139 forks source link

Performance regression in 1.12.1 #374

Open spawnia opened 2 years ago

spawnia commented 2 years ago

Upgrading this library to 1.12.1 or above causes a massive slowdown of our test runs. Here is how long our tests run with different versions of this library:

Some details about our project:

Thanks for this library, please let me know if you need further details from me.

agriffis commented 2 years ago

@spawnia Have you looked at the differences between 1.12.0 and 1.12.1 to see what might be causing this?

agriffis commented 2 years ago

Actually it seems clear that the culprit would be the caching changes in https://github.com/styled-components/babel-plugin-styled-components/pull/327

Not sure yet why those caused a slowdown, though.

spawnia commented 2 years ago

Thanks for looking into this @agriffis. I did compare the two tags via https://github.com/styled-components/babel-plugin-styled-components/compare/v1.12.0...v1.12.1, but was intimated by the large number of changed lines. Turns out the actual code changes were quite small, you identified them correctly.

I also cannot tell why those changes would be an issue, I can just give you more information about our environment: we are consuming a component library which itself uses this plugin and is bundled with rollup, but the slowdown happens when updating the dependency in our main application. This main application does not use rollup.

Malgalad commented 2 years ago

Not fixed in 2.0.7. Dev build takes about 27s, while on 1.12.0 build runs in 7s.