From 8ea33e2e0c281e7d71a79b8270d04add8a95c931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CJoshua?= Date: Wed, 18 Sep 2024 15:39:07 -0400 Subject: [PATCH] Measure time eval of register_block_type_assets --- plugins/woocommerce/src/Blocks/BlockTypes/AbstractBlock.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/AbstractBlock.php b/plugins/woocommerce/src/Blocks/BlockTypes/AbstractBlock.php index 152715c951a..15d91f613cb 100644 --- a/plugins/woocommerce/src/Blocks/BlockTypes/AbstractBlock.php +++ b/plugins/woocommerce/src/Blocks/BlockTypes/AbstractBlock.php @@ -8,6 +8,8 @@ use Automattic\WooCommerce\Blocks\Assets\Api as AssetApi; use Automattic\WooCommerce\Blocks\Integrations\IntegrationRegistry; use Automattic\WooCommerce\Admin\Features\Features; +$t = 0; + /** * AbstractBlock class. */ @@ -92,7 +94,11 @@ abstract class AbstractBlock { public function render_callback( $attributes = [], $content = '', $block = null ) { $render_callback_attributes = $this->parse_render_callback_attributes( $attributes ); if ( ! is_admin() && ! WC()->is_rest_api_request() ) { + global $t; + $s = microtime(true); $this->register_block_type_assets(); + $t += microtime(true) - $s; + error_log('register_block_type_assets ms: ' . $t); $this->enqueue_assets( $render_callback_attributes, $content, $block ); } return $this->render( $render_callback_attributes, $content, $block );