babel-plugin-styled-components icon indicating copy to clipboard operation
babel-plugin-styled-components copied to clipboard

Performance regression in 1.12.1

Open spawnia opened this issue 2 years ago • 4 comments

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:

  • 1.12.0: 175s
  • 1.12.1: 757s
  • 1.13.0: 884s
  • 2.0.6: 796s

Some details about our project:

  • node 14.18.3
  • webpack 5.70.0
  • @babel/core 7.17.5
  • styled-components 5.2.1
  • react 16.13.1
  • jest 26.6.3

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

spawnia avatar Mar 08 '22 11:03 spawnia

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

agriffis avatar Apr 05 '22 16:04 agriffis

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.

agriffis avatar Apr 05 '22 17:04 agriffis

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.

spawnia avatar Apr 06 '22 08:04 spawnia

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

Malgalad avatar Apr 18 '22 17:04 Malgalad