Timeline for Craft model and populateModels() performance issue?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 9, 2015 at 11:31 | vote | accept | Sam Hibberd | ||
Sep 9, 2015 at 11:31 | comment | added | Sam Hibberd | Sorry Luke, just saw you answer! Exactly as expected, thanks!!! | |
Sep 9, 2015 at 11:30 | comment | added | Sam Hibberd | Yes, this was the issue, although your suggestion certainly helped speed things up. What do you mean by cache in the function? Set a var that is checked before grabbing the entry and set only if it has not be retrieved? | |
Sep 9, 2015 at 10:24 | history | edited | Luke Holder | CC BY-SA 3.0 |
added example
|
Sep 9, 2015 at 10:15 | comment | added | Luke Holder |
ah yes, you are doing a db call every time you do block.entry . You could cache it in the plugin function or just assign it once per block in the template like so: {% set blockEntry = block.entry %}. This would have been causing the huge slowdown more than my answer.
|
|
Sep 9, 2015 at 10:14 | comment | added | Sam Hibberd |
Ah I see, removing {{ block.ruleClasses }} improved things a drop, but I was accessing {{ block.entry.customField }} loads of times, storing / caching the entry and accessing it via this var helped loads. So does it get the entry each time i hit block.entry??
|
|
Sep 9, 2015 at 9:15 | history | answered | Luke Holder | CC BY-SA 3.0 |