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

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.

tech