Minimising number of queries on a page when using Advanced Custom Fields

I’m currently working on a site where there is extensive use of the popular Advanced Custom Fields plugin. However, as a result the page loading time can be quite slow, especially when using the Gallery plugin.

Does anyone have suggestions regarding what the best practice is with managing a large number of custom fields? In some cases I am effectively working with thousands of variables, and need to reduce the page load time from some cases around 5s.

Quite an open question I know, though really it would be great to have some suggestions regarding how number of queries in a page can be minimised (such as through directly accessing values in the database perhaps rather than relying on a plugin’s APIs?).

3 Answers
3

Performance optimization doesn’t really work in vaccum, it takes hands-on profiling an looking for actual bottle necks (which often turn out to be different from perceived ones).

But it general there are several approaches to the need of lots of database data:

  1. Optimize fetching from database, for example by concatenating multiple requests into retrieving single larger set of data.

  2. Install persistent object cache and keep data in memory for faster turnaround.

  3. Cache resulting calculations or markup fragments to reduce how often they need to be retrieved and possibly making it async from actual page load.

Leave a Comment