-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Dramatic performance difference between blade component and blade helper #190
Comments
Hey @MaxGiting, I think you might have missed the caching section here? https://github.com/blade-ui-kit/blade-icons#caching |
@driesvints Thanks for the quick reply! I should have mentioned it in the original issue. I have caching turned on and still see the time difference. |
@MaxGiting that's very odd. I'll try out your repo as soon as I find some time. |
@driesvints thank you. I have simplified the original issue as caching removed the differences on 1st and subsequent page loads. But yes the difference between blade component and @svg still exists. |
Just had a quick look into this. When using the blade component, most of the time is spent in the following method.... Shared equally between this line... and. this line.... |
I managed to reproduce this with your repo @MaxGiting, thank you. However, I did not figure out the root cause of this even though with @JayBizzle indications. I have to say, that I find the current differences in speed to not be overly dramatic. I use Blade Icons on several projects, and haven't experienced much slowness after we implemented icon caching. Therefor, I won't be taking any action here right now. However, should anyone find the root cause of this, I'd very much appreciate a PR. Otherwise, if this is really a concern for you, I suggest to use the svg helper or directives for now. Thanks |
I experienced the same when using the components. Even with caching, requests where around 130 ms slower with the font awesome icons. Disabled components and switched to the svg helper and the difference was really noticeable. Am I correct in that when using the svg helper it has no impact on performance? Since blade views are created and cached in production? Thanks for this package @driesvints 👍 |
Not entirely sure if it's "no impact" but it's far less than components apparently. |
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".
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:
composer install
php artisan icons:cache
artisan serve
and visit the homepageThe text was updated successfully, but these errors were encountered: