In a recent project if lots of blade components I faced some slow rendering issues.
What made a difference on that project was:
- Use traditional layout directives, instead of blade components for layout
-
@\extends,@\yield,@\section,@\stackand@\push(slashes added to avoid mentions)
-
- Make sure every blade component have a class
Looking at the framework's code, for every anonymous blade component (e.g. a component without a class) Laravel creates am instance of Illuminate\View\AnonymousComponent class for it. So, in practice, every component is expected to have a companion class, and if they don't have one, Laravel will use this AnonymousComponent class instead.
Not sure why this slows down code execution, but for that project, both Memory consumption and render time dropped by a lot.
I know it is not very convenient to create a lot of classes if you already have a bunch of class-less components. Believe me when I started seeing noticeable differences I created a ton of them. But it solved my problems then, maybe it could help you out.
Good luck!