0

Im very interested in plugin development for wordpress. But I need to get a better understanding as to what parts of a plugins functionality is causing more or less harm to the performance of wordpress.

Im especially interested in the following questions:

  • lets say we're registering 3 post types: is it worse for performance to do this in 3 different plugins (one for each post type), than registering all 3 in one plugin? in other words, is using an extra plugin adding to the load time, even if it doesn't do anything?

  • if I use wordpress' functions to look up the value for 2 different options, is that then considered 2 mySQL queries?

  • What parts of a plugin is likely to cause additional load times to normal non-logged in users loading the theme?

  • What are the most important do's and don'ts when it comes to performance in plugin development

  • How does language translation with get text influence performance?

Any insights and/or links to resources on these topic are of big interest!

2

lets say we're registering 3 post types: is it worse for performance to do this in 3 different plugins (one for each post type), than registering all 3 in one plugin? in other words, is using an extra plugin adding to the load time, even if it doesn't do anything?

The technical process of plugin load is a simple PHP include. So there is no significant penalty to have more plugins loading than less, however it's not quite simple as to say there is no difference.

if I use wordpress' functions to look up the value for 2 different options, is that then considered 2 mySQL queries?

In a nutshell WP options can be set to autoload or not to individually. All autoloaded options are queried once per page load with single query. All not autoloaded options will require additional query per option.

What parts of a plugin is likely to cause additional load times to normal non-logged in users loading the theme?

Plugins contain arbitrary code and in turn cause arbitrary performance issues.

What are the most important do's and don'ts when it comes to performance in plugin development

Do not guess, do performance profiling.

How does language translation with get text influence performance?

While translation is not especially slow, it can quickly add up when dealing with hundreds and thousands of calls. It is kind of necessary evil from performance point of view, but always keep an eye out that you are not doing too much wasted movements with it, like translating same strings repeatedly.

  • Thanks a lot for these insights! I edited my 3rd question in order for it to make more sense :) – Malibur Jul 24 '14 at 16:17
  • haha, fair enough - would you be able to recommend any tools to help with profiling? – Malibur Jul 24 '14 at 16:21
  • @MaltheMilthers Laps, Query Monitor, XHProf – Rarst Jul 24 '14 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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