There is a huge speed difference depending on which method you use to include an icon using this package.
The two methods I have checked are:
Blade Component <x-heroicon-o-arrow-right/>
Blade Helper @svg('hero icon-o-arrow-up')
Using the "helper method" is on average 10 times faster to render than using the "component method". It can be up to 20 times faster on the very first page load.
1st page load values
2nd page load (and after) values
The speed differences aren't much when loading a single icon. However on my website I have a page that lists 80 products per page, with each one having 3 icons. Here it makes sense for me to use @svg as the load time quickly adds up.
Why is using @svg so much faster than <x-heroicon-xxxxx/>?
There is a huge speed difference depending on which method you use to include an icon using this package. The two methods I have checked are:
<x-heroicon-o-arrow-right/>
@svg('hero icon-o-arrow-up')
Using the "helper method" is on average 10 times faster to render than using the "component method". It can be up to 20 times faster on the very first page load.
The speed differences aren't much when loading a single icon. However on my website I have a page that lists 80 products per page, with each one having 3 icons. Here it makes sense for me to use
@svg
as the load time quickly adds up.Why is using
@svg
so much faster than<x-heroicon-xxxxx/>
?I have created a sample repo so anyone can easily run the tests for themselves. https://github.com/MaxGiting/blade-ui-performance
To get the sample repo to work you will need to clone, run composer update, artisan serve and visit the homepage.