oandregal
dafa13a0b9
Themes: improve performance of get_block_templates().
...
`get_block_templates()` is responsible for finding block templates that match a given search. The function receives a query parameter with the relevant metadata (slugs of the templates, areas of the template parts, etc) to find the user templates (database) and theme templates (file directory).
This function can be made more performant by changing how it works. Before this change, it processed all the block templates and discarded the ones that didn't match the query after it occurred. This commit makes it so it discards the templates that don't match the query before processing them. As a result, it only has to process the subset of templates that will be used, instead of all of them.
This change impacts any theme with block templates. TwentyTwentyThree reports a 15% improvement in Time To First Byte.
Props spacedmonkey, jorgefilipecosta, youknowriad, flixos90, mukesh27.
Fixes #57756 .
Built from https://develop.svn.wordpress.org/trunk@55687
git-svn-id: http://core.svn.wordpress.org/trunk@55199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-26 14:40:19 +00:00
..
2023-03-21 12:43:46 +00:00
2023-03-13 16:32:20 +00:00
2023-03-14 15:45:47 +00:00
2023-03-21 12:43:46 +00:00
2023-02-23 11:06:19 +00:00
2023-04-21 13:32:25 +00:00
2023-04-04 14:56:22 +00:00
2023-01-20 01:36:10 +00:00
2023-04-12 23:44:22 +00:00
2022-12-08 19:31:17 +00:00
2023-03-17 14:22:22 +00:00
2022-12-12 20:21:12 +00:00
2023-04-05 13:12:26 +00:00
2023-04-21 10:43:25 +00:00
2023-02-03 13:35:20 +00:00
2023-02-01 16:15:15 +00:00
2022-11-26 21:01:17 +00:00
2023-04-24 16:37:22 +00:00
2023-02-23 12:34:18 +00:00
2023-03-01 15:39:27 +00:00
2023-03-01 11:43:20 +00:00
2023-02-06 19:40:16 +00:00
2023-04-26 14:40:19 +00:00
2023-04-26 14:27:24 +00:00
2023-04-21 10:43:25 +00:00
2023-02-21 16:39:19 +00:00
2023-02-15 13:06:21 +00:00
2022-11-29 15:51:14 +00:00
2023-02-04 15:18:16 +00:00
2023-02-03 13:35:20 +00:00
2023-02-13 09:08:23 +00:00
2023-02-11 12:43:22 +00:00
2023-04-05 13:12:26 +00:00
2023-02-03 13:35:20 +00:00
2023-02-03 13:35:20 +00:00
2023-02-07 14:05:20 +00:00
2023-03-21 20:00:19 +00:00
2023-02-07 07:04:52 +00:00
2023-02-01 15:29:13 +00:00
2023-02-06 15:24:16 +00:00
2023-04-21 10:43:25 +00:00
2022-11-23 21:30:13 +00:00
2023-03-29 10:20:20 +00:00
2023-04-24 16:37:22 +00:00
2023-02-07 17:10:21 +00:00
2023-02-23 10:38:21 +00:00
2023-02-07 17:10:21 +00:00
2023-02-07 17:10:21 +00:00
2023-02-07 17:10:21 +00:00
2023-02-07 17:10:21 +00:00
2022-11-08 13:29:16 +00:00
2022-11-25 15:12:16 +00:00
2022-11-25 15:12:16 +00:00
2023-04-12 09:43:21 +00:00
2023-02-19 15:05:22 +00:00
2023-02-21 16:39:19 +00:00
2023-02-23 10:38:21 +00:00
2023-04-11 22:06:22 +00:00
2022-10-21 21:12:14 +00:00
2022-12-15 21:32:17 +00:00
2022-12-15 21:32:17 +00:00
2023-01-13 14:22:12 +00:00
2023-02-21 01:49:20 +00:00
2023-02-22 14:25:25 +00:00
2023-02-25 10:59:22 +00:00
2023-02-08 17:08:21 +00:00
2023-02-15 23:37:17 +00:00
2023-02-21 16:39:19 +00:00
2023-03-29 10:50:18 +00:00
2023-03-10 16:30:03 +00:00
2023-03-14 16:55:19 +00:00
2022-11-13 13:51:20 +00:00
2023-02-23 10:38:21 +00:00
2023-04-10 12:56:21 +00:00
2023-01-30 10:27:16 +00:00
2023-02-21 15:59:18 +00:00
2023-04-10 12:56:21 +00:00
2022-10-24 14:56:16 +00:00
2023-03-10 16:30:03 +00:00
2022-11-23 21:30:13 +00:00
2022-11-26 09:39:13 +00:00
2023-04-21 09:24:22 +00:00
2023-01-30 15:24:13 +00:00
2023-02-07 17:10:21 +00:00
2023-02-15 22:56:20 +00:00
2023-03-01 16:17:18 +00:00
2023-02-15 22:56:20 +00:00
2023-02-27 15:34:23 +00:00
2023-04-24 13:53:22 +00:00
2022-11-29 15:51:14 +00:00
2023-02-21 16:39:19 +00:00
2023-04-17 17:01:24 +00:00
2022-10-18 16:11:16 +00:00
2023-02-28 12:48:23 +00:00
2023-04-19 14:40:19 +00:00
2023-04-09 11:57:22 +00:00
2023-01-25 01:40:12 +00:00
2023-04-09 11:57:22 +00:00
2023-04-18 11:50:27 +00:00
2023-04-16 10:48:22 +00:00
2022-11-26 21:01:17 +00:00
2023-02-12 18:08:21 +00:00
2023-04-22 15:19:22 +00:00
2023-04-10 12:56:21 +00:00
2023-01-15 14:57:13 +00:00
2023-01-15 14:57:13 +00:00
2023-04-23 04:02:18 +00:00
2023-02-02 18:52:17 +00:00
2023-04-13 15:43:21 +00:00
2023-04-04 14:56:22 +00:00
2023-04-22 15:19:22 +00:00
2023-02-15 23:37:17 +00:00
2023-03-10 16:30:03 +00:00
2023-04-24 13:53:22 +00:00
2023-03-07 04:47:22 +00:00
2023-02-13 18:34:17 +00:00
2023-02-21 16:39:19 +00:00
2023-04-24 13:53:22 +00:00
2023-02-24 01:23:20 +00:00
2022-12-09 11:54:13 +00:00
2023-04-18 11:50:27 +00:00
2023-02-23 10:38:21 +00:00
2022-10-18 18:16:16 +00:00
2023-03-10 16:30:03 +00:00
2023-02-16 00:04:21 +00:00
2023-02-15 22:56:20 +00:00
2023-02-07 12:49:17 +00:00
2023-04-25 14:57:23 +00:00
2023-02-21 16:39:19 +00:00
2023-04-15 12:11:24 +00:00
2023-01-19 07:34:14 +00:00
2023-04-22 15:19:22 +00:00
2023-03-10 16:30:03 +00:00
2023-02-07 21:21:18 +00:00
2023-02-22 20:49:20 +00:00
2022-12-15 11:03:11 +00:00
2023-04-10 19:31:18 +00:00
2023-04-21 03:13:22 +00:00
2023-01-23 16:35:12 +00:00
2023-04-21 09:24:22 +00:00
2023-04-10 12:56:21 +00:00
2023-02-19 15:05:22 +00:00
2023-02-22 16:00:21 +00:00
2023-04-22 15:19:22 +00:00
2023-04-09 11:57:22 +00:00
2023-04-18 11:50:27 +00:00
2023-02-23 10:38:21 +00:00
2023-04-26 14:40:19 +00:00
2023-02-23 11:06:19 +00:00