Skip to content

Object caching per-row for wp-admin lists

We have added an option to use object-caching per-row for lists in your wp-admin area.

Probably the place this will affect you the most is on either your WooCommerce -> Orders or your Products pages, as these are most commonly the admin pages which end up with either lots of custom functions and columns or lots of individual rows or both.

Technical Implementation

The plugin extends the WP_Posts_List_Table. The constructor in the new class clones the existing Posts_List table and then overrides the single_row method which contstructs the table row. You may frequently see 20 or 30 SQL queries per row, so caching this entire HTML row eliminates all of that.

There is a hook added to post_updated which deletes this cache from the object cache.

Performance Results

For customers with large numbers of orders, you’ll see a big speed boost on your WooCommerce -> Orders list admin page. For customers with large numbers of products, you’ll see a big speed boost on your wp-admin -> Products list page.

In the above example, I’m fetching 100 orders per page. The above is without this new feature.

Then with the feature enabled, this same page drops to 160 queries total and 2.52 second generation time. This remaining generation time is consumed constructing the counts per post for the table header. Given that we have 100 rows being returned, that means in this example each row was generating 10 queries. Those are all eliminated with this update.

The good news is we’re eliminating a lot of CPU cycles in addition to speeding up these admin pages.

Limitations

This update is currently restricted to running on WooCommerce -> Orders and the Products lists. If there is demand, we can add this to other admin pages.

Did this article answer your question?

Leave a Reply

Your email address will not be published. Required fields are marked *