Any tips on an optimisation approach? #1873
Replies: 5 comments 3 replies
-
Even when I have blank Blade files it is still taking 6s which is slow. |
Beta Was this translation helpful? Give feedback.
-
A solution that works is to do a custom HasBlocks trait and use caching if not in preview mode. |
Beta Was this translation helpful? Give feedback.
-
Hi @michaeljcoyne, there are a lot of things that could affect your local loading time. As far as retrieving Twill data goes, optimization techniques are the same as Laravel's, like avoiding n+1 queries by leveraging eager-loading and/or introducing caching (config, routes, queries), etc... I'd recommend using a package like Laravel Debug Bar to understand where that time is going. |
Beta Was this translation helpful? Give feedback.
-
Hi @ifox The slowness was all Twills code. As I say I have done a custom trait which caches the render blocks functionality and the speed is in milliseconds now. I could tell this as I alreaddy have the debug bar. Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi @ifox Yes I use translations, medias, repeaters and fair few attributes. I need to for my site. I will have to look into cache generation of related modules perhaps via a task which gets hit on the Model boot method (when it gets updated). This should solve the problem of cold cache - but probably not the easiest task to write to find all related browser modules then regenerate the cache depending if it is on that page. But I think this is the approach I will take. Currently I am clearing the whole cache on the base model boot - which isn't ideal. |
Beta Was this translation helpful? Give feedback.
-
Looking at my debugbar. My page is taking 10s to load locally.
There are quite a few blocks just rendering out the data in blade.
Does anyone have any tips for optimisation?
I am starting with creating block classes and using Laravels cache. To try to speed up response time but would like to hear any other tips for Twill.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions