Very slow server performance when rendering large number of rows and columns - slow blade rendering
I have a client where one of the requirements is to regularly have views containing 100, 200 or sometimes even more rows on the screen at any time.
The database is fairly small and well-indexed, all queries are less than 1ms. The database is not the problem, there are no n+1 queries etc. The problem appears to be related purely to blade components.
Here are some approximate benchmarks in my application:
50 rows = 0.7s
100 rows = 1.3s
200 rows = 2.79s
500 rows = 6.4s
I have extensively googled this and have tried the following:
Laravel Optimizations:
PHP/Nginx Optimizations:
I have gzip enabled (although this is irrelevant for this particular issue since that's just for network transfer), opcache enabled, JIT enabled.
I use Clockwork, not debugbar but I have also benchmarked my app with Clockwork turned off and also on production (where there is no clockwork) with similar results.
I ran an xdebug profile for 100 rows (see attached) and can see that 90% of time is spent rendering the blade components. During the page load my CPU on that particular core spikes to 100%. There definitely seems to be something not optimal here, either with FilamentPHP or LiveWire or perhaps Laravel itself (I am leaning towards the latter).
I have tried disabling each column one by one to see if perhaps one column is causing this, but the time seems to be fairly linear... disabling half the columns results in about half of the render time. Interestingly, the actions seem to add quite a lot of time also to the render (even though I only have 4 actions, but again it seems linear).
Has anyone got any ideas for me or is anyone able to render large tables without this huge performance hit? Thanks in advance.
The database is fairly small and well-indexed, all queries are less than 1ms. The database is not the problem, there are no n+1 queries etc. The problem appears to be related purely to blade components.
Here are some approximate benchmarks in my application:
50 rows = 0.7s
100 rows = 1.3s
200 rows = 2.79s
500 rows = 6.4s
I have extensively googled this and have tried the following:
Laravel Optimizations:
PHP/Nginx Optimizations:
I have gzip enabled (although this is irrelevant for this particular issue since that's just for network transfer), opcache enabled, JIT enabled.
I use Clockwork, not debugbar but I have also benchmarked my app with Clockwork turned off and also on production (where there is no clockwork) with similar results.
I ran an xdebug profile for 100 rows (see attached) and can see that 90% of time is spent rendering the blade components. During the page load my CPU on that particular core spikes to 100%. There definitely seems to be something not optimal here, either with FilamentPHP or LiveWire or perhaps Laravel itself (I am leaning towards the latter).
I have tried disabling each column one by one to see if perhaps one column is causing this, but the time seems to be fairly linear... disabling half the columns results in about half of the render time. Interestingly, the actions seem to add quite a lot of time also to the render (even though I only have 4 actions, but again it seems linear).
Has anyone got any ideas for me or is anyone able to render large tables without this huge performance hit? Thanks in advance.


