Cache makes bundling slower instead of faster in recent versions (starting with 0.19.0)?
See original GitHub issueIt seems that the build cache of this plugin makes performance worse instead of improving it, starting with package version 0.19.0.
I noticed this when upgrading the build scripts at my company to use the latest package versions of everything; including an update of ezolenko/rollup-plugin-typescript2
from version 0.12.x to 0.19.2. This increased bundling times by a factor of approx. 2x (from approx. 3 sec. to 6-8 sec per bundling).
I thought I’d share my brief investigations with you. I set up a small benchmark (see stakx/rollup-plugin-typescript2-benchmark
) to demonstrate this. Admittedly it’s not a super-accurate benchmark, but I think it still shows that setting the clean
option to false
appears to affect bundling time negatively (instead of improving it, as one would expect from having a cache ready for use).
I’ll reproduce the measurements I took below; see the linked repo for the actual benchmark code.
Package version | run | clean: true [ms] |
clean: false [ms] |
clean: false ÷ clean: true [%] |
---|---|---|---|---|
0.15.0 | 1 | 836 | 670 | |
2 | 840 | 638 | ||
3 | 884 | 574 | ||
avg. | 853 | 627 | 74 % | |
0.16.0 | 1 | 841 | 576 | |
2 | 816 | 607 | ||
3 | 834 | 581 | ||
avg. | 830 | 588 | 71 % | |
0.17.0 | 1 | 861 | 582 | |
2 | 839 | 603 | ||
3 | 835 | 594 | ||
avg. | 845 | 593 | 70 % | |
0.18.0 | 1 | 1147 | 998 | |
2 | 1192 | 882 | ||
3 | 1207 | 882 | ||
avg. | 1182 | 921 | 78 % | |
0.18.1 | 1 | 815 | 617 | |
2 | 837 | 590 | ||
3 | 823 | 590 | ||
avg. | 825 | 599 | 73 % | |
0.19.0 | 1 | 828 | 896 | |
2 | 803 | 897 | ||
3 | 836 | 901 | ||
avg. | 822 | 898 | 109 % | |
0.19.1 | 1 | 850 | 913 | |
2 | 825 | 888 | ||
3 | 799 | 881 | ||
avg. | 825 | 894 | 108 % | |
0.19.2 | 1 | 1020* | 888 | |
2 | 816 | 902 | ||
3 | 826 | 890 | ||
avg. | 887 | 893 | 101 % |
Note how having a cache populated (clean: false
) led to quicker bundling times (approx. 70 % of clean: false
) up until 0.18.1. Starting with 0.19.0, clean: false
would actually increase bundling times by approx. 10 %. (Note also the outlier marked with a *, which makes 0.19.2 appear to perform better than it really does.)
This cache slowdown is quite a pity especially since clean: false
is currently the default.
(P.S.: I’d like to make clear that I’m not saying clean: false
will by itself be sufficient to worsen performance of this plugin. I simply noticed this and found it curious, it might be worth looking into more closely.)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top GitHub Comments
In 0.19.3 on npm now
Awesome! Thank you for taking care of this so promptly. Great to see a project being maintained so well. 👍