The problem
DIVI is one of the themes for which we have built a demo to showcase our WooCommerce search plugin.
But DIVI is also the only theme, or page builder, that failed to load fast on a 100K WooCommerce products shop.
The detection
All our other demos, in the exact same conditions (Cloudways, 100K products), are loading fast.
But with DIVI, it is quite another story: 15 seconds to load the Shop page!
We decided to investigate by activating the Query monitor plugin. Below are the screen captures that led us to find the culprit.
a) 15 seconds (just in PHP, this does not include front-end load times, like images, css and js files)
b) 0,5 second with Flatsome (same demo, but with Flatsome instead of DIVI)
c) Slow queries are detected
d) The PHP call stack of each slow query
The explanation
In past version of DIVI (we checked with 3.0) , the issue was not there.
But in more recent versions, DIVI introduced a method et_get_attachment_id_by_url() to retrieve an attachment id from its url. This method is called for each image in your shop results (15 times in our demo). But the problem is that this method is not scalable: the more products you have in WooCommerce, the slower it gets.
So, on the 2k products demo: 20 x 0.06 = 1.2 seconds spent in et_get_attachment_id_by_url()
But on the 100k products demo: 20 x 0.6 = 12 seconds spent in et_get_attachment_id_by_url()
12 seconds or more are spent in a single DIVI function !