Performance impact of using functions in WordPress?

I have a website that generates lots of dynamic contents. I’m facing performance issues even on my localhost, on a Corei7 processor.

I’ve tried to disable every unnecessary plugin, and ran p3 performance profiler to see the results. The resulting charts show that most of the loading time is spent on WordPress’s core (not plugins).

I’m using simple functions like if() and bloginfo('name') and call metadatas like get_post_meta() and the_permalink() a lot of times on my pages, one could say maybe up to 50 functions in each page.

These functions seem very simple, however i’m not sure how much impact do they have on loading time.

Is there a way to find out which parts of the page consume the most time? or is there a general guide to understand how much impact does these functions have on WordPress?

Thanks are in orders.

Solutions Collecting From Web of "Performance impact of using functions in WordPress?"

The overhead of PHP function as a mechanism is minimal. After all nearly everything going on is function calls. On a reasonable hardware you will have to ramp up function calls into thousands and tens of thousands to generate significant overhead (as opposed to doing same things with less function calls involved).

Worth noting that PHP profilers tend to overestimate the impact of function calls. Xdebug is especially eager to do that. More so just having Xdebug enabled can slow things down in environment heavy on function calls.

P3 profiler uses PHP ticks mechanism to profile, which is highly unreliable.

For any realistic outlook into performance you need to use a profiler that works on PHP engine level, such as Xdebug or Blackfire. In lack of such your performance troubleshooting options are very limited and basically amount to stuffing code with timers and ripping it apart until you figure out the slow part.

p3 performance profiler

This plugin worked well, but now I found it is not a good quality anymore. Have you noted the same?

You should relax and let the web server do stuff. Pick smart plugins from trusted authors.

When you write themes or plugins do as much as possible ob_start() magic to buffer your output.

I wish PHP will become ahead of time, and thus faster.