d13r/laravel-breadcrumbs

Breadcrumb cache command

dwightwatson opened this issue · 4 comments

On a bigger application the number of breadcrumb definitions can get pretty big, and unless I'm mistaken these are processed on every request. In a similar vein to the Artisan commands for caching routes and app configuration, perhaps a command for caching breadcrumbs could be considered.

d13r commented

Hi Dwight,

Thanks for the suggestion. I'm not sure how much difference it would make since all it's doing at startup time is pushing the closures onto an array - it's not until you call render() or generate() that it really does any work. And I don't think that bit could be cached since it's running arbitrary code under the control of the user that could do anything. So the only optimisation I can see would be moving all those closures into a pre-generated array instead of pushing them one-by-one, which I would guess gives minimal time savings (especially compared to the amount of work required to implement it). Having said that I've not tried timing it, and you (or someone else) are welcome to try to optimise it - it's just not high my list of things to do myself.

Cheers
Dave

No worries, thanks for the response. I understand what you're saying about the startup process, it sounds very familiar to the one used by the Laravel router. I'll try to make some time to do some performance testing to see if there is a good opportunity to do something here, would be more than happy to contribute.

Also, thanks for this package - pleasure to work with and seems to make it into every Laravel app I work on.

d13r commented

Cool, thanks. Glad you like it. 😀

d13r commented

Laravel Breadcrumbs is no longer officially maintained
Please see the README file for further details.