Sergey Biryukov
9bf6faff7c
Editor: Reduce the use of the _wp_array_get()
function to improve performance.
...
`_wp_array_get()` is an expensive function, and it's called thousands of times on each page view on the front end. While the function performance was slightly improved in #58376 , it is still called more times than it should be.
This commit aims to further optimize its usage:
* In many cases, `_wp_array_get()` can be replaced with a much simpler and faster `isset()` check.
* The `isset()` function is capable of checking nested arrays, so `isset( $foo['a']['b']['c'] )` will return false even if `$foo['a']` is unset, without throwing any errors or warnings.
* When `_wp_array_get()` cannot be directly replaced with `isset()`, it would be good practice to wrap it in an `isset()` function so that `_wp_array_get()` only runs when it needs to.
Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/51116 #51116 Performance improvement: Reduce the use of the _wp_array_get() function]
Follow-up to [55851], [56382].
Props aristath, jrf, spacedmonkey, mukesh27, swissspidy, hellofromTonya.
Fixes #59405 .
Built from https://develop.svn.wordpress.org/trunk@56709
git-svn-id: http://core.svn.wordpress.org/trunk@56221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 13:47:20 +00:00
..
2023-09-21 13:26:32 +00:00
2022-04-12 09:26:16 +00:00
2023-09-26 13:47:20 +00:00
2023-09-21 13:26:32 +00:00
2023-09-21 13:26:32 +00:00
2023-09-25 21:05:21 +00:00
2023-09-25 21:29:17 +00:00
2023-09-26 09:17:18 +00:00
2023-04-04 14:56:22 +00:00
2023-09-21 13:26:32 +00:00
2023-08-29 13:46:23 +00:00
2023-09-09 09:28:26 +00:00
2023-09-11 10:33:19 +00:00
2023-09-25 10:03:38 +00:00
2023-09-26 12:42:19 +00:00
2023-04-30 14:08:23 +00:00
2023-09-21 00:18:23 +00:00
2023-05-12 08:51:22 +00:00
2023-06-19 18:27:27 +00:00
2023-09-25 22:38:17 +00:00
2023-09-25 17:06:34 +00:00
2023-05-14 17:58:24 +00:00
2023-09-26 12:28:22 +00:00
2023-08-25 05:11:17 +00:00
2023-09-21 16:18:17 +00:00
2023-09-01 17:32:16 +00:00
2023-09-26 13:47:20 +00:00
2023-06-22 14:57:24 +00:00
2023-07-09 20:17:29 +00:00
2023-09-22 00:04:41 +00:00
2023-07-09 20:17:29 +00:00
2023-09-26 00:27:12 +00:00
2023-08-24 09:01:16 +00:00
2022-06-17 11:20:13 +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-05-12 21:35:21 +00:00
2023-09-14 12:46:20 +00:00
2023-09-08 09:32:23 +00:00
2023-09-09 09:28:26 +00:00
2023-06-27 15:26:27 +00:00
2023-09-14 12:46:20 +00:00
2023-09-14 12:46:20 +00:00
2023-07-09 20:17:29 +00:00
2023-05-08 22:37:24 +00:00
2023-09-08 09:32:23 +00:00
2023-06-27 00:45:38 +00:00
2023-06-27 00:45:38 +00:00
2023-06-27 00:45:38 +00:00
2023-09-21 16:18:17 +00:00
2023-05-08 22:37:24 +00:00
2023-06-23 06:29:23 +00:00
2023-09-14 13:25:18 +00:00
2023-09-09 09:28:26 +00:00
2023-08-21 17:51:19 +00:00
2023-09-09 09:28:26 +00:00
2023-08-24 08:44:24 +00:00
2023-09-08 09:32:23 +00:00
2023-09-25 21:05:21 +00:00
2023-09-25 21:05:21 +00:00
2023-09-10 09:04:18 +00:00
2023-09-10 09:04:18 +00:00
2023-09-10 09:04:18 +00:00
2023-09-25 21:05:21 +00:00
2023-06-22 14:36:26 +00:00
2023-09-08 09:32:23 +00:00
2023-09-26 13:47:20 +00:00
2023-07-14 20:59:26 +00:00
2023-07-09 20:17:29 +00:00
2023-02-21 16:39:19 +00:00
2023-02-23 10:38:21 +00:00
2023-08-10 01:06:21 +00:00
2023-09-18 12:41:18 +00:00
2023-06-24 17:17:23 +00:00
2023-09-21 18:29:12 +00:00
2023-06-22 14:57:24 +00:00
2023-06-22 14:36:26 +00:00
2023-09-21 18:29:12 +00:00
2023-09-21 18:29:12 +00:00
2023-08-19 00:10:23 +00:00
2023-09-08 09:32:23 +00:00
2023-09-07 14:59:21 +00:00
2023-09-09 09:28:26 +00:00
2023-07-09 21:25:23 +00:00
2023-07-09 21:25:23 +00:00
2023-09-09 09:28:26 +00:00
2023-05-11 11:15:24 +00:00
2023-09-12 15:23:18 +00:00
2023-03-10 16:30:03 +00:00
2023-07-12 09:46:25 +00:00
2023-03-14 16:55:19 +00:00
2023-07-09 21:25:23 +00:00
2023-09-05 19:26:26 +00:00
2023-09-21 19:34:18 +00:00
2023-05-02 15:45:22 +00:00
2023-02-21 15:59:18 +00:00
2023-05-02 15:45:22 +00:00
2023-09-09 09:28:26 +00:00
2023-09-08 09:32:23 +00:00
2023-07-28 11:37:25 +00:00
2023-09-25 21:05:21 +00:00
2023-08-10 01:06:21 +00:00
2023-08-10 01:06:21 +00:00
2023-06-22 14:36:26 +00:00
2023-05-02 15:45:22 +00:00
2023-07-08 10:48:24 +00:00
2023-04-27 23:15:17 +00:00
2023-09-14 12:40:18 +00:00
2023-09-08 09:32:23 +00:00
2023-09-08 10:03:21 +00:00
2023-07-09 21:25:23 +00:00
2023-09-08 09:32:23 +00:00
2023-09-26 13:47:20 +00:00
2023-05-06 11:40:24 +00:00
2023-09-26 13:47:20 +00:00
2023-09-19 16:17:22 +00:00
2023-09-07 20:45:16 +00:00
2023-07-10 12:53:26 +00:00
2023-09-09 09:28:26 +00:00
2023-08-25 01:28:16 +00:00
2023-09-20 19:31:20 +00:00
2023-08-13 10:31:23 +00:00
2023-09-09 09:28:26 +00:00
2023-09-25 21:05:21 +00:00
2023-09-08 10:03:21 +00:00
2023-09-09 09:28:26 +00:00
2023-09-11 05:27:22 +00:00
2023-09-20 17:27:23 +00:00
2023-09-26 00:13:12 +00:00
2023-09-26 13:47:20 +00:00
2023-09-25 17:06:34 +00:00
2023-05-02 15:45:22 +00:00
2023-07-29 00:31:35 +00:00
2023-02-12 18:08:21 +00:00
2023-07-09 21:48:22 +00:00
2023-09-07 17:30:17 +00:00
2023-09-26 00:27:12 +00:00
2023-09-26 12:38:19 +00:00
2023-08-18 17:29:20 +00:00
2023-09-08 10:03:21 +00:00
2023-08-24 19:59:17 +00:00
2023-08-03 12:10:28 +00:00
2023-09-22 19:08:19 +00:00
2023-07-10 22:38:25 +00:00
2023-09-19 12:30:14 +00:00
2023-08-18 17:29:20 +00:00
2023-09-08 10:03:21 +00:00
2023-09-20 17:27:23 +00:00
2023-09-16 21:49:27 +00:00
2023-09-26 00:13:12 +00:00
2023-07-10 22:38:25 +00:00
2023-06-22 14:57:24 +00:00
2023-07-10 22:48:22 +00:00
2023-02-24 01:23:20 +00:00
2023-06-22 14:57:24 +00:00
2023-08-23 15:53:24 +00:00
2023-07-10 22:48:22 +00:00
2023-07-10 22:48:22 +00:00
2023-05-02 11:26:24 +00:00
2023-06-22 14:57:24 +00:00
2023-09-09 09:28:26 +00:00
2023-02-16 00:04:21 +00:00
2023-07-10 22:48:22 +00:00
2023-07-25 06:30:20 +00:00
2023-09-25 16:25:19 +00:00
2023-09-25 22:38:17 +00:00
2023-06-08 07:54:22 +00:00
2023-02-21 16:39:19 +00:00
2023-08-22 12:30:29 +00:00
2023-05-17 18:31:24 +00:00
2023-09-26 00:27:12 +00:00
2023-08-24 09:01:16 +00:00
2023-07-10 22:48:22 +00:00
2023-08-04 11:58:25 +00:00
2023-07-11 11:15:27 +00:00
2020-11-16 22:52:05 +00:00
2023-04-10 19:31:18 +00:00
2023-09-25 21:05:21 +00:00
2023-07-20 00:06:21 +00:00
2023-09-14 04:56:21 +00:00
2023-09-25 15:36:18 +00:00
2021-12-10 20:30:05 +00:00
2023-09-20 17:27:23 +00:00
2023-09-06 21:48:17 +00:00
2023-09-25 21:05:21 +00:00
2023-09-21 06:35:20 +00:00
2023-09-25 22:38:17 +00:00
2023-09-12 15:23:18 +00:00
2023-09-14 01:25:16 +00:00
2023-09-20 20:51:19 +00:00
2023-09-26 13:47:20 +00:00
2023-07-10 23:11:22 +00:00