question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

build time with postcss-purgecss is ~4x slower on v2.1.0 compared to 1.4.2

See original GitHub issue

I just ran a few tests and here are the results I’m getting:

Build time without postcss-purgecss: 76.02s

Build time with “@fullhuman/postcss-purgecss”: “^1.4.2”, 111.81s

Build time with “@fullhuman/postcss-purgecss”: “^2.1.0”, 385.60s

Here is the contents of my postcss.config.js

module.exports = {
  plugins: [
    process.env.NODE_ENV === 'production' ? require('@fullhuman/postcss-purgecss')({
      content: [
        './public/**/*.html',
        './src/**/*.vue',
        // custom
        './node_modules/vue-multiselect/src/Multiselect.vue',
        // './node_modules/vue-tables-2/**/*',
        './node_modules/bootstrap-vue/src/components/**/*.js',
      ],
      defaultExtractor: (content) => {
        const contentWithoutStyleBlocks = content.replace(/<style[^]+?<\/style>/gi, '');
        return contentWithoutStyleBlocks.match(/[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g) || [];
      },
      whitelistPatterns: [
        /-(leave|enter|appear)(|-(to|from|active))$/,
        /^(?!cursor-move).+-move$/,
        /^router-link(|-exact)-active$/,
        // custom
        /^multiselect/,
      ],
    }) : '',
  ],
};

Any idea why this is happening and if there’s a way to get reasonable build times using the latest version?

Many thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
leeoniyacommented, Apr 4, 2020

i’d also be interested with how it improves here (tested against 1.4.0):

https://github.com/leeoniya/dropcss#performance https://github.com/leeoniya/dropcss/tree/master/test/bench#readme

the source & corpus for the stress bench are in the second link, if interested.

2reactions
Fflorielcommented, Apr 4, 2020

I added a branch here. You will see a package named comparison. It will run PurgeCSS v1 and PurgeCSS v2 and print times in the console. Was thinking of going through the performance investigation too so I’ll definitely be open to review a PR about it. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poor performance as part of a webpack PostCSS build system
It takes about 10 seconds on my MacBook Pro 2019 just changing a single color in a .pcss file, and it appears externally...
Read more >
Remove unused CSS | CssRepo
build time with postcss -purgecss is ~4x slower on v2.1.0 compared to 1.4.2. I just ran a few tests and here are the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found