Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?).

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

Yet is near heresy, but yes, if you want very efficient queries with very large and complicated date sets "directly accessing values in the database ... rather than relying on a plugin's APIs" is almost certainly the way this will work out.

I don't know about the particular plugin in question but frankly, plugins tend to be horribly inefficient. Some considerable blame lies with WordPress itself, as a number of its own core functions are inefficient and another fair chunk are not flexible enough to allow the kinds of queries/alterations that would allow the kind of efficiency I'd like. This in turn, forces plugin authors to either buck the strongly encouraged "use Core functions" rule, or make due with less efficient mechanisms. I believe can effect your ability to get things into the wordpress.org repos. I don't really submit to the repos so I am not very familiar with the rules but I know there are rules.

On the downside, "directly accessing values in the database" is going to mean more upkeep for the plugin as you will have track WordPress database structure changes.

share|improve this answer
    
I expected the down vote, but it doesn't change the facts. –  s_ha_dum Oct 16 '12 at 19:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.