DEV Community

Cover image for Here's how I increased website performance by 21%!

Here's how I increased website performance by 21%!

Paul C. Ishaili on September 24, 2022

P.S.: A lot of updates have been made on this post from the comments and feedback on this article So for days, I have been keen on how I could p...
Collapse
 
roelmagdaleno profile image
Roel Magdaleno

Hey man, for icons, I personally inline SVG with heroicons.com.

Why? The inline SVG will be parsed by the browser, won't do extra requests, and won't render-block the website.

What you just did was to remove the external request from cdnjs.cloudflare.com domain (the website will try to connect to that domain, that includes: DNS + Connection + SSL) and load the library locally, that's fine but it's still loading some woff2 fonts but now inside your domain. (I don't know how many of them you're using, you didn't specify, but those are still making requests)

Also, the fontawesome.min.css local file (and all CSS files) is always considered as a render-blocking which means the CSS file will be requested and parsed by the browser before doing any JavaScript and other render jobs.

The fontawesome.min.css local file is also huge and might contain unused code because you're not using all fonts, that can be fixed with Critical CSS but you'll need those woff2 fonts.

So, to wrap up. This is performance analysis and can be tricky while you optimize your website because CSS, JavaScript and more can affect your scores. I highly recommend to analyse your website with webpagetest.org, so you can see what's going on with your website under the hood.

Thanks. :)

Reference:

Collapse
 
tr11 profile image
Tiago Rangel

Typo found! 🤣 "Loading Fontawesome locally", "fontwaesome"
Anyway, great article!

Collapse
 
tr11 profile image
Tiago Rangel

Same inside the How to properly load font-awesome locally category, point 1

Collapse
 
mrpaulishaili profile image
Paul C. Ishaili

🙏 Thank you so much! Corrections implemented! 🎉

Collapse
 
mrpaulishaili profile image
Paul C. Ishaili

😧 Noted @tiagorangel2011! Thanks for finding that out! Hope you gained something from it too?

Collapse
 
tr11 profile image
Tiago Rangel

I normaly don't use font awesome 😁. I prefer material icons.

Collapse
 
laerciolopesll profile image
LaercioLopesLL

I like to use SVG, always load faster than fontawesome, even locally

Collapse
 
mrpaulishaili profile image
Paul C. Ishaili

You are very correct @laerciolopesll! Can you share on how you use yours, sir? It will greatly the performant enthusiasts 😊.

I really appreciate you engaging! 🙏 Thank you so much!

Collapse
 
laerciolopesll profile image
LaercioLopesLL

Well, when I started using fontawesome, icons that load dynamically by JS always load with a delay, they appear as a [], so I put an SVG in place of an icon and I had no delay. When I use Vue I make icon components.
The generated html is more verbose, I don't know if this impacts page loading or performance...
Thank you for being so kind in your response.

Thread Thread
 
mrpaulishaili profile image
Paul C. Ishaili

Okay. Here's a link to the platform I use in measuring any site performance of projects I work on: web.dev/measure. From your feedback I also decided to do a little research on if actually there it is a possibility use svg rather than the tag locally with Fontwesome, then I found something very interesting which I will be sharing soon. Most of this are actually best for vanilla projects in HTML / PHP / EJS. Libraries/Frameworks such as React, VueJS, etc. uses svgs/icons from the ones installed in the node_modules packages therefore, would have worked on it's optimality.

🙏 Thank you so much too for your interesting and intriguing responses.

Collapse
 
mrepol742 profile image
Melvin Jones Repol

i personally prefered adding the svg inside html than downloading the fontawesome and hosting it on my own... because the project or a page may not use the fontawesome and only few icons..

Collapse
 
mrpaulishaili profile image
Paul C. Ishaili

🎉 Exactly! I get the point!

However, with this, your local FontAwesome file size wouldn't be up to even 500kb. I have made some discovery also which I will be sharing soon on how you can make this even lesser and more convenient as adding the SVG tag.

🙏 Thanks for engaging @mrepol742 .

Collapse
 
cicirello profile image
Vincent A. Cicirello

Early on in the post, you said that you "stumbled on this particular solution whose author actually deserves a shout-out". Who is it that deserves a shout-out?

Collapse
 
mrpaulishaili profile image
Paul C. Ishaili

@cicirello I appreciate that. Check in the resouces section of the post.

I'd have to make an edit to fix that right in this article!

Thanks once again!

Collapse
 
cicirello profile image
Vincent A. Cicirello

Oh, I see. It's based on the StackOverflow answer you linked to at the bottom.

Collapse
 
jhvanderschee profile image
Joost van der Schee

I like the improvement, but there is no real reason to score below 100%. usecue.com/blog/how-to-get-a-100-g...

Collapse
 
leober_ramos33 profile image
Leober Ramos

No, but fontawesome is very used, and most of the time it is not loaded in this way, which can help raise the score a little, but it will not do a miracle.

Collapse
 
mrpaulishaili profile image
Paul C. Ishaili

🎉 Great article link you shared here @jhvanderschee! I should defintely see how this can help on this project too!

Thanks so much, especially for engaging!

Collapse
 
jhvanderschee profile image
Joost van der Schee

Thank you for your kind response! Happy coding!

Collapse
 
techman09 profile image
TechMan09

If you only have a few icons per page, you could load the icons individual, saving even more time.

Any why did your SEO score go down, did you change something else?

Collapse
 
behrjozef profile image
Jozef Behr

I will try for my website then let you know ..

Collapse
 
mrpaulishaili profile image
Paul C. Ishaili

Thanks 👍 for engaging, @behrjozef! Can't wait to here your view on implementation.

Collapse
 
mrpaulishaili profile image
Paul C. Ishaili

Thank you all so much for the reacitons and responses. 🙏 It means alot.

Collapse
 
fedoravpn profile image
Lawrence

Heroicoins is an svg created by Tailwind. There is no need to use cdn or download to local directory.

Collapse
 
anurag_vishwakarma profile image
Anurag Vishwakarma

Please share for WordPress sites too.

Collapse
 
leober_ramos33 profile image
Leober Ramos

Manu plugins in WordPress that use FontAwesome load its locally, don't worry.

Collapse
 
dhruvjoshi9 profile image
Dhruv Joshi

Nice tips!!! I am sharing it with my teams!

Collapse
 
annie profile image
Annie

Hello, can I reprint and translate your article? I will include a link to the article.

Collapse
 
mrpaulishaili profile image
Paul C. Ishaili

Thank you, Annie. It will be such an honor! I can't wait to read it!