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

5.x performance and size #267

Open
XhmikosR opened this issue Nov 13, 2019 · 4 comments
Open

5.x performance and size #267

XhmikosR opened this issue Nov 13, 2019 · 4 comments

Comments

@XhmikosR
Copy link
Collaborator

XhmikosR commented Nov 13, 2019

I was wondering, do we really need prettier? It's not a small dependency... https://packagephobia.now.sh/result?p=prettier

And this affects not only download size (https://packagephobia.now.sh/result?p=inline-critical) but also module load time. On my machine v4.x loads significantly faster:

C:\Users\xmr\Desktop\inline-critical>git branch
  master
* v4.x

C:\Users\xmr\Desktop\inline-critical>node load-time.js
Load time
Module: 209.547ms

C:\Users\xmr\Desktop\inline-critical>node load-time.js
Load time
Module: 198.942ms

C:\Users\xmr\Desktop\inline-critical>node load-time.js
Load time
Module: 200.581ms

C:\Users\xmr\Desktop\inline-critical>node load-time.js
Load time
Module: 179.488ms

C:\Users\xmr\Desktop\inline-critical>git branch
* master
  v4.x

C:\Users\xmr\Desktop\inline-critical>node load-time.js
Load time
Module: 713.050ms

C:\Users\xmr\Desktop\inline-critical>node load-time.js
Load time
Module: 702.322ms

C:\Users\xmr\Desktop\inline-critical>node load-time.js
Load time
Module: 715.274ms

C:\Users\xmr\Desktop\inline-critical>node load-time.js
Load time
Module: 684.928ms

The slowdown isn't only from prettier, but could be from jsdom too.

Why can't we just not minify the critical CSS if minify: false? It should help a bit.

@XhmikosR XhmikosR changed the title Remove prettier 5.x performance and size Nov 13, 2019
@XhmikosR
Copy link
Collaborator Author

And this obviously affects any module that depends on inline-critical.

I haven't looked into the exact causes on critical, but there 1.x is also a lot faster (~2x) to load:

critical 1.x branch:

C:\Users\xmr\Desktop\critical>node load-time.js
Load time
Module: 1173.415ms

C:\Users\xmr\Desktop\critical>node load-time.js
Load time
Module: 786.801ms

C:\Users\xmr\Desktop\critical>node load-time.js
Load time
Module: 777.586ms

C:\Users\xmr\Desktop\critical>node load-time.js
Load time
Module: 772.247ms

critical master branch:

C:\Users\xmr\Desktop\critical>node load-time.js
Load time
Module: 1439.240ms

C:\Users\xmr\Desktop\critical>node load-time.js
Load time
Module: 1362.473ms

C:\Users\xmr\Desktop\critical>node load-time.js
Load time
Module: 1369.047ms

C:\Users\xmr\Desktop\critical>node load-time.js
Load time
Module: 1357.941ms

So, I think improving the performance in inline-ciritical should improve the performance in critical too. Especially if we remove prettier from critical too later.

@bezoerb
Copy link
Owner

bezoerb commented Nov 15, 2019

This means we need to disable the debug feature and always return/inline minified css.
After thinking about it i'm fine with this but this would mean a breaking change.
As we are still in kind of beta for critical i think it's ok to stay with the 2.x there but for inline-critical we should go for a 6.0 then

@XhmikosR
Copy link
Collaborator Author

If you can make a branch and ping me before merging, I could do some more tests. Because jsdom is also quite big compared to cheerio, so prettier isn't the only issue, I think.

@bezoerb
Copy link
Owner

bezoerb commented Apr 4, 2021

Sorry for the late response ;)
Prettier is removed.
For jsdom/cheerio, i used cheerio before but there were issues when it comes to inlined XML so i had to switch to jsdom instead.

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