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

FontAwesome Kit ruins Lighthouse site performance results #16146

Open
4 of 7 tasks
alystair opened this issue Feb 4, 2020 · 8 comments
Open
4 of 7 tasks

FontAwesome Kit ruins Lighthouse site performance results #16146

alystair opened this issue Feb 4, 2020 · 8 comments

Comments

@alystair
Copy link

alystair commented Feb 4, 2020

Describe the bug
FontAwesome Kit has a major impact on Lighthouse performance score. This probably represents real life performance implications on older mobile devices.

To Reproduce
Visit https://web.dev/measure/ or use Chrome's built-in Lighthouse in DevTools with default settings to test any site using a FontAwesome Kit /w SVG. Heck, running it on a simple page like https://fontawesome.com/icons/font-awesome-flag results in a performance score of... 4 (out of 100).

Expected behavior
FontAwesome JS should not block main thread in such an impactful manner.

Screenshots
https://fontawesome.com/icons/font-awesome-flag
image

Own site, larger impact
image

Version and implementation
Version: Latest (kit)
Browser and version: Chrome Version 79.0.3945.130 (Official Build) (64-bit)

  • SVG with JS
  • Web Fonts with CSS
  • SVG Sprites
  • On the Desktop

Bug report checklist

  • I have filled out as much of the above information as I can
  • I have included a test case because my odds go way up that the team can fix this when I do
  • I have searched for existing issues and to the best of my knowledge this is not a duplicate
@alystair
Copy link
Author

alystair commented Feb 6, 2020

Related to #16077 in that they are both somewhat Lighthouse related, although this one is more critical from a performance perspective..

@alystair
Copy link
Author

@tagliala Could you please tag this appropriately? ❤️

@tagliala
Copy link
Member

tagliala commented Feb 18, 2020

Hi @alystair sorry for the late reply

Could you please provide a reproducible test case that is related to Font Awesome Kit rather than fontawesome.com documentation?

Auditing here is not that terrible: https://tagliala.github.io/fa15167-kit

@toomsbzh
Copy link

toomsbzh commented May 6, 2020

Hi, i have the same issue with random big response time. This problem is in your example too @tagliala.
Capture d’écran 2020-05-06 à 10 02 27

@alystair
Copy link
Author

alystair commented May 6, 2020

at 4x slowdown, the fact that my entire web framework inits in 80-140ms best/worst scripting time compared to 210-420ms of the barebone demo you provided means something funky is going on.

Looking at FA's network graph alone I'd guesss instead of parsing the DOM first and collecting all outstanding icons for a 'batch' fetch, it starts fetching whilst parsing?

image

Using raw SVGs for our mission critical work for now... don't have time to drill down into the script/code.

@tagliala
Copy link
Member

tagliala commented May 6, 2020

@toomsbzh Let's ask @robmadole if he is aware of random slow response time of individual svg files


@alystair

Looking at FA's network graph alone I'd guesss instead of parsing the DOM first and collecting all outstanding icons for a 'batch' fetch, it starts fetching whilst parsing?

Thanks for the hint. That demo is not optimized for performance, I'm just synchronously loading a kit in the head tag for other purposes, but I can see what you are saying and it looks it depends on how the Pro kit individually fetches the icons found

@robmadole could you please check if there is room for improvement here?

Using raw SVGs for our mission critical work for now... don't have time to drill down into the script/code.

I think that it is the best choice for your use case, and this should be one of the reason why we are providing individual svgs.

I think that loading the FA SVG framework, via cdn, kit or optimized pro kit, will introduce an overhead that does not seem compatible with your performance constraints

@alystair
Copy link
Author

alystair commented May 7, 2020

It's just overall concern for FA Kit overhead on mobile devices. There's probably room for optimization, which would allow for wider adoption :)

@robmadole
Copy link
Member

@toomsbzh Let's ask @robmadole if he is aware of random slow response time of individual svg files

Yes, we've had reports about this. Our CDN provider and a lot of other providers are experiencing issues during COVID-19. @toomsbzh if this is a persistent issue send us an email at hello@fontawesome.com so we can take a deeper look.

@alystair FontAwesome Kit has a major impact on Lighthouse performance score

Our own site (fontawesome.com) is abysmal but our use case is pretty unique. Do you have a Lighthouse report for your own site?

at 4x slowdown, the fact that my entire web framework inits in 80-140ms best/worst scripting time compared to 210-420ms of the barebone demo you provided means something funky is going on.

That does sound funky. Do you have a test case we can take a look at?

Looking at FA's network graph alone I'd guesss instead of parsing the DOM first and collecting all outstanding icons for a 'batch' fetch, it starts fetching whilst parsing?

Correct. This is intentional. We also use requestAnimationFrame to defer the DOM updates in a batch. For Kits this is the performance trade-off we made. Luckily we have a lot of different ways you can use Font Awesome (with a JS framework like React or Vue, as sprites, with the subsetter, or individual SVGs). Depending on your performance needs we try to provide a solution.

It's just overall concern for FA Kit overhead on mobile devices. There's probably room for optimization, which would allow for wider adoption

We looked at mobile performance with Kits and didn't see anything problematic. If you have some evidence that we missed something we'd love to see some numbers.

I'm inclined to close this issues unless there is something specific we need to work on.

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

No branches or pull requests

4 participants