Commit de43a57
committed
Script Loader: Guard against exponential recursion during calculation of loading strategy and fetchpriority.
This addresses a performance issue in the recursive `WP_Scripts::get_highest_fetchpriority_with_dependents()` and `WP_Scripts::filter_eligible_strategies()` methods for redundant processing of shared dependencies in complex dependency graphs. To fix this, a `$stored_results` param is introduced which is passed by reference; this variable contains a cache of the calculated results for all scripts handles, so that subsequent calls for the same handle can return the cached value instead of re-computing it.
Developed in #10459
Follow-up to [60704], [60931], [56033].
Props ciobanucatalin, b1ink0, westonruter, mukesh27.
See #61734, #12009.
Fixes #64194.
git-svn-id: https://develop.svn.wordpress.org/trunk@61176 602fd350-edb4-49c9-b593-d223f7449a821 parent 6680408 commit de43a57
File tree
2 files changed
+91
-11
lines changed- src/wp-includes
- tests/phpunit/tests/dependencies
2 files changed
+91
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
997 | 997 | | |
998 | 998 | | |
999 | 999 | | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
1003 | 1004 | | |
1004 | 1005 | | |
1005 | | - | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
1006 | 1011 | | |
1007 | 1012 | | |
1008 | 1013 | | |
| |||
1053 | 1058 | | |
1054 | 1059 | | |
1055 | 1060 | | |
1056 | | - | |
| 1061 | + | |
1057 | 1062 | | |
1058 | | - | |
| 1063 | + | |
1059 | 1064 | | |
1060 | 1065 | | |
1061 | 1066 | | |
| |||
1066 | 1071 | | |
1067 | 1072 | | |
1068 | 1073 | | |
1069 | | - | |
1070 | | - | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
1071 | 1077 | | |
1072 | 1078 | | |
1073 | | - | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1074 | 1084 | | |
1075 | 1085 | | |
1076 | 1086 | | |
| |||
1099 | 1109 | | |
1100 | 1110 | | |
1101 | 1111 | | |
1102 | | - | |
| 1112 | + | |
1103 | 1113 | | |
1104 | 1114 | | |
1105 | 1115 | | |
| |||
1111 | 1121 | | |
1112 | 1122 | | |
1113 | 1123 | | |
1114 | | - | |
| 1124 | + | |
1115 | 1125 | | |
1116 | 1126 | | |
1117 | 1127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1435 | 1435 | | |
1436 | 1436 | | |
1437 | 1437 | | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
1438 | 1473 | | |
1439 | 1474 | | |
1440 | 1475 | | |
| |||
1534 | 1569 | | |
1535 | 1570 | | |
1536 | 1571 | | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
1537 | 1607 | | |
1538 | 1608 | | |
1539 | 1609 | | |
| |||
0 commit comments