blade-ui-kit / blade-heroicons

A package to easily make use of Heroicons in your Laravel Blade views.
https://blade-ui-kit.com/blade-icons
MIT License
560 stars 50 forks source link

Dramatic performance difference between blade component vs blade helper #26

Closed MaxGiting closed 2 years ago

MaxGiting commented 2 years ago

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:

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
Screenshot 2022-03-31 at 13 58 56 Screenshot 2022-03-31 at 13 59 17

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.

MaxGiting commented 2 years ago

Closed as I moved this issue to the base repo https://github.com/blade-ui-kit/blade-ui-kit/issues/130