Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature_request(conflict): grunt-critical + grunt-pageres + grunt-load-config #65

Open
Kristinita opened this issue Sep 27, 2020 · 5 comments

Comments

@Kristinita
Copy link

Kristinita commented Sep 27, 2020

1. Summary

If I use grunt-critical + grunt-pageres + grunt-load-config:

    grunt-critical 2.0.0 is more than 10x slower than 1.1.3.

2. Details

2.1. Real project

My AppVeyor build was not completed in 1 hour — quota per build job. Although before that the build time did not exceed 25 minutes; see for example my next build. AppVeyor hangs on the grunt-critical task.

I ran the grunt-critical task for my project on the local machine.

  • 2.0.0:
Execution Time (2020-09-18 08:56:19 UTC+3)
loading tasks         12ms  0%
critical:dist    21m 31.6s  ██████████████████████████████████████████████████████████████ 100%
Total 21m 31.6s
  • 1.1.3:
Execution Time (2020-09-18 11:30:39 UTC+3)
loading tasks       21ms  0%
critical:dist   1m 42.6s  ██████████████████████████████████████████████████████████████ 100%
Total 1m 42.6s

2.2. Puppeteer

If I use grunt-critical and grunt-pageres:

    Chromium is installed 2 times.

See output of npm install command for my MCVE:

$ npm install

> puppeteer@1.20.0 install /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/capture-website/node_modules/puppeteer

Chromium downloaded to /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/capture-website/node_modules/puppeteer/.local-chromium/linux-686378
> puppeteer@2.1.1 install /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/puppeteer

Chromium downloaded to /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/puppeteer/.local-chromium/linux-722234

3. MCVE

Forming the MCVE turned out to be a long job.

You can see it in KiraCritical branch of my demo/debugging repository:

  1. Gruntfile.coffee:

    module.exports = (grunt) ->
    
        require('time-grunt') grunt
    
        grunt.loadNpmTasks 'grunt-critical'
    
        grunt.initConfig
    
            critical:
                dist:
                    options:
                        extract: false
                    files: [
                        expand: true
                        cwd: "output/"
                        src: [
                                "IT-articles/*.html"
                                "Sublime-Text/*.html"
                                "Programs/*.html"]
                        dest: "."
                        ]
        return
  2. Part of package.json:

    "devDependencies": {
        "coffeescript": "^2.5.1",
        "grunt": "^1.3.0",
        "grunt-critical": "^2.0.0",
        "grunt-pageres": "^4.0.1",
        "load-grunt-config": "^3.0.1",
        "load-grunt-tasks": "^5.1.0",
        "time-grunt": "^2.0.0"
    }
  3. .travis.yml:

    os: linux
    
    dist: focal
    
    cache: false
    
    git:
      depth: 1
    
    language: node_js
    
    node_js:
    - node
    
    install:
    - npm install -g grunt-cli
    - npm install
    
    script:
    - grunt critical --verbose
    

And some real HTML and CSS files.

4. Behavior

4.1. Expected

Without conflicting plugins grunt-critical 2.0.0 completed the task in 18.8 seconds.

4.2. Current

If we add to our Gruntfile.coffee the line:

require('time-grunt') grunt

+ require('load-grunt-config') grunt

grunt.loadNpmTasks 'grunt-critical'

grunt-critical completed the same task in 4 minutes 27.6 seconds.

5. Don’t offer

5.1. “It not my issue, update grunt-pageres subdependencies”

Possibly, updating subdependencies of critical and/or pageres won’t fix the problem. In the future, it is possible that critical and pageres will have different versions of Puppeteer → Chromium will be installed 2 times again → problem from my issue may repeat.

It would be nice to have such a solution so that this problem doesn’t recur in the future.

Thanks.

@Kristinita
Copy link
Author

@bezoerb , is any ideas how to fix it?

Thanks.

@bezoerb
Copy link
Owner

bezoerb commented Oct 6, 2020

Hey @Kristinita, thanks for the detailed report. I will have to look into this in detail. I already checked the KiraCritical branch without any errors.
Time without require('load-grunt-config') grunt: 14s
Time with require('load-grunt-config') grunt: 16.1s

I'm checking the master branch now to see if i can find something.

@bezoerb
Copy link
Owner

bezoerb commented Oct 6, 2020

Sorry... i could not find anything reasonable.

@Kristinita
Copy link
Author

Status: Need more info 🤔

@bezoerb

1. Questions

Excuse me, I didn’t understand what you were doing. Please let me know what can I do to better clarify the problem? Could you please advise how you get 14 and 16.1 seconds?

2. About MCVE

I remind you that I have reproduced my problem on Travis CI.

Travis CI builds:

  1. Without require('load-grunt-config') grunt
  2. With require('load-grunt-config') grunt

You can find details in these builds.

3. master branch

I'm checking the master branch now to see if i can find something.

If you talk about master branch of my “SashaGruntDebugging” repository, then it was created 2,5 years ago to demonstrate a different problem, not related to grunt-critical.

Thanks.

@bezoerb
Copy link
Owner

bezoerb commented Oct 14, 2020

I think i did the same things you did on Travis CI:
I checked the KiraCriticalbranch.
Without the line require('load-grunt-config') grunt the command grunt critical took 14s
After adding the require('load-grunt-config') grunt the command took 16.1s

I wasn't able to reproduce your problem on my local hardware. This makes it somehow impossible for me to debug the time difference you are experiencing

I checked the master branch of your KristinitaPelican repo (the one failing on appveyor) as well as the appveyor output of the failing build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants