List pages performance

I'm paginating to 25 items a large table (>5k items) and the performance it's terrible. 5 seconds on my localhost with opcache enabled. Memory is also really high. I've tried to override the getTableQuery function in the List resource file to select only the fields I'm showing in the table, but has no effect on the memory used. What can I do to improve this?
24 Replies
Dan Harrin
Dan Harrin2y ago
that is abnormally high in the demo it only uses 10% of memory and 2% of the time but we cant debug this for you how many table columns do you have? what is the response time and memory usage for a non-filament page
buzkall
buzkallOP2y ago
8 columns
buzkall
buzkallOP2y ago
and a page on the frontend behaves differently
Dan Harrin
Dan Harrin2y ago
how about an admin page without tables
buzkall
buzkallOP2y ago
I know you can't debug this for me, I'm just asking if there any hint you can give
buzkall
buzkallOP2y ago
that's another weird thing that signals I've something wrong... If I enter the edit page of one of those list elements shows 4Mb of memory and under 500ms, but for a brief moment before loading, the debugbar shows that hydrates all the elements on that table
Dan Harrin
Dan Harrin2y ago
try removing stuff one by one until you work out what causes it
buzkall
buzkallOP2y ago
in the form function, you mean?
Dan Harrin
Dan Harrin2y ago
in the table function of the slow page
buzkall
buzkallOP2y ago
leaving just the id in the table takes 2.19s and 34mb of memory
Dan Harrin
Dan Harrin2y ago
okay well its not that then must be something else on the page or resource or in a service provider or middleware
buzkall
buzkallOP2y ago
yes, seems that some code in the AppServiceProvider is affecting this! removing it goes down to 12Mb
Dan Harrin
Dan Harrin2y ago
great that sounds more reasonable
buzkall
buzkallOP2y ago
It's a view::composer added there to allow all the frontend pages to have a shared menu I wasn't aware that that can mess this!
Dan Harrin
Dan Harrin2y ago
add it in a middleware only to your frontend routes
buzkall
buzkallOP2y ago
hmm, ok will try that and about the moment that debugbar shows all the elements in models tab?... do you have any clue about that behaviour?
Dan Harrin
Dan Harrin2y ago
i dont know but i think its on your end
buzkall
buzkallOP2y ago
ok, thanks! I've discovered what it was! I was using the ->options() function in a relationship select
toeknee
toeknee2y ago
Interesting
Dan Harrin
Dan Harrin2y ago
make sure to wrap the options in a fn () =>
buzkall
buzkallOP2y ago
I was using fn ->options(fn() => Activity::getOptions()), when I've removed that, that weird behaviour from the screenshot, has ended
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dan Harrin
Dan Harrin2y ago
everyone who has reported this issue has later decided its not filament so check your service providers and middleware etc
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server