Great, thanks!
Slow search on a site based on Divi Theme
-
In fact, the problem can sometimes be caused not by a slow search by WPFTS plugin or even by a slow generation of Smart Excerpts. The search slowdown was caused by a bug (or flaw) in the code of the Divi theme itself.
Let's get closer to the code. So, one of the clients contacted us with a complaint that some search requests took too long to process (about 10-12 seconds), which is extremely non-standard for WPFTS even with 500k records, and the client at that time had less than 1000 records. The problem was detected on WPFTS Pro v2.51.212.
After spending several hours deeply studying the code, we found out that due to a flaw in the code of the Divi Theme, post previews are generated anew each time when displaying search results, while logically they should be generated only once and then used.
There is indeed such a check in the code, but it only works for those images that are smaller in size along one of the axes (height or width). If the image is larger than the target size of the preview, then the code for checking the presence of an already generated preview is simply not called, and the preview is generated again.
This spends 1-2 seconds for each post in the output results, which, with a number of 10 posts, gives a noticeable slowdown of 10-15 seconds.
Below we have attached a new version of the Divi Theme file which is suitable for version 4.25.2. We have already reported the bug to the authors of this topic, so we hope that it will be fixed in future versions.
We hope this article helped you.
DIVI_THEME_FIX.ZIP