Ecommerce Shopify WordPress Discussion

Where should I look for performance issues when number and time of queries and memory don't change?

I'm a little new to php performance testing. I'm debugging a custom wordpress theme (made by me) and I've got a page that is too slow. The page loads something like 250 posts. Each of them has several custom fields (acf pro). I've found a couple of function that query for acf values are the bottleneck. In particular, there's one that, inside the wp loop, will raise the page loading time of about 1 second. The problem is that, it's only that: I mean, the only thing that changes is page load time (even without rendering nothing), but total query time, memory peak and number of queries doesn't changes that much. Very little. Using Query Monitor plugin for measures. The function is very simple, like: public function get_field_value($field, $use_filtered_fields = true, $raw_value = false, $post_id = null, $lang = null){ if(!$post_id) return null; if($lang) $t_post_id = pll_get_post($post_id, $lang); // Polylang query, not always used $pid = (!empty($t_post_id)) ? $t_post_id : $post_id; $field_metadata = $this->fields_metadata[$field]; // fields_metadata is just an array $field_group_name = $field_metadata['group']; $field_group = get_field($field_group_name, $pid); // ACF query $field_value = $field_group[$field]; if(isset($field_metadata['datatype']) && !$raw_value){ if($field_metadata['datatype'] == 'file' && $field_metadata['subtype'] == 'pdf'){ if(isset($field_value['url'])) return $field_value['url']; } } return $field_value; } As you can see it only queries for an ACF field and for the rest is just 'static' array access, so I don't know why its so slow. Other than being called 250 times (about the number of posts I'm currently testing). So my question is: when some code only affects page load but not memory usage, nor total query time or total number of queries, where should I look at? Where should I look to find the reason of raised page load time (again: no rendering here for now, no js, no html, only code 'computation')?
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.