Make WordPress Core

Opened 15 hours ago

Last modified 10 hours ago

#66416 new enhancement

register_block_type_from_metadata performs unneccesary file system operations for blocks resolved from metadata registry

Reported by: kalessil Owned by:
Priority: normal Milestone: Awaiting Review
Component: General Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

If block metadata has been resolved via WP_Block_Metadata_Registry::get_metadata, register_block_type_from_metadata performs excessive file_exists calls, which affects block registration performance.

E.g., on Mac M4, Woo core blocks (around 170 blocks) registration in a standard wp-env-based environment drops from ±15ms to ±5ms if file_exists is skipped (which is feasible when blocks are resolved via the registry).

Change History (3)

This ticket was mentioned in ​PR #15179 on ​WordPress/wordpress-develop by ​kalessil.


15 hours ago
#1

  • Keywords has-patch added

Trac ticket: [
](https://core.trac.wordpress.org/ticket/66416)

Use of AI Tools

AI assistance: Yes
Tool(s): Claude
Used for: adopting the optimization fixes from ​https://github.com/woocommerce/woocommerce/pull/70056 into the upstream function

​kalessil commented on ​PR #15179:


14 hours ago
#2

@felixarntz, @gziolo, @swissspidy: looking into ​https://github.com/WordPress/wordpress-develop/pull/8129, it looks like you have decent context in the area I'm touching in this PR. Mind taking a look and sharings some feedback in case I missed something?

Here are the details from track0ticket:

 If block metadata has been resolved via WP_Block_Metadata_Registry::get_metadata, register_block_type_from_metadata performs excessive file_exists calls, which affects block registration performance.

E.g., on Mac M4, Woo core blocks (around 170 blocks) registration in a standard wp-env-based environment drops from ±15ms to ±5ms if file_exists is skipped (which is feasible when blocks are resolved via the registry). 

​@swissspidy commented on ​PR #15179:


10 hours ago
#3

Perhaps @westonruter? I'm currently on vacation.

Note: See TracTickets for help on using tickets.