Skip to content

Commit 251b789

Browse files
authored
Use fast ZPP for ParentNode manipulation methods (#14981)
These are very common, and parsing variadic arguments takes a very long time, so this optimization makes sense to do.
1 parent f58a3c3 commit 251b789

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

ext/dom/element.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,9 +1453,9 @@ PHP_METHOD(DOMElement, after)
14531453
zval *args;
14541454
dom_object *intern;
14551455

1456-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) {
1457-
RETURN_THROWS();
1458-
}
1456+
ZEND_PARSE_PARAMETERS_START(0, -1)
1457+
Z_PARAM_VARIADIC('*', args, argc)
1458+
ZEND_PARSE_PARAMETERS_END();
14591459

14601460
DOM_GET_THIS_INTERN(intern);
14611461

@@ -1468,9 +1468,9 @@ PHP_METHOD(DOMElement, before)
14681468
zval *args;
14691469
dom_object *intern;
14701470

1471-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) {
1472-
RETURN_THROWS();
1473-
}
1471+
ZEND_PARSE_PARAMETERS_START(0, -1)
1472+
Z_PARAM_VARIADIC('*', args, argc)
1473+
ZEND_PARSE_PARAMETERS_END();
14741474

14751475
DOM_GET_THIS_INTERN(intern);
14761476

@@ -1486,9 +1486,9 @@ PHP_METHOD(DOMElement, append)
14861486
zval *args;
14871487
dom_object *intern;
14881488

1489-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) {
1490-
RETURN_THROWS();
1491-
}
1489+
ZEND_PARSE_PARAMETERS_START(0, -1)
1490+
Z_PARAM_VARIADIC('*', args, argc)
1491+
ZEND_PARSE_PARAMETERS_END();
14921492

14931493
DOM_GET_THIS_INTERN(intern);
14941494

@@ -1505,9 +1505,9 @@ PHP_METHOD(DOMElement, prepend)
15051505
zval *args;
15061506
dom_object *intern;
15071507

1508-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) {
1509-
RETURN_THROWS();
1510-
}
1508+
ZEND_PARSE_PARAMETERS_START(0, -1)
1509+
Z_PARAM_VARIADIC('*', args, argc)
1510+
ZEND_PARSE_PARAMETERS_END();
15111511

15121512
DOM_GET_THIS_INTERN(intern);
15131513

@@ -1524,9 +1524,9 @@ PHP_METHOD(DOMElement, replaceWith)
15241524
zval *args;
15251525
dom_object *intern;
15261526

1527-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) {
1528-
RETURN_THROWS();
1529-
}
1527+
ZEND_PARSE_PARAMETERS_START(0, -1)
1528+
Z_PARAM_VARIADIC('*', args, argc)
1529+
ZEND_PARSE_PARAMETERS_END();
15301530

15311531
DOM_GET_THIS_INTERN(intern);
15321532

@@ -1543,9 +1543,9 @@ PHP_METHOD(DOMElement, replaceChildren)
15431543
zval *args;
15441544
dom_object *intern;
15451545

1546-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &args, &argc) == FAILURE) {
1547-
RETURN_THROWS();
1548-
}
1546+
ZEND_PARSE_PARAMETERS_START(0, -1)
1547+
Z_PARAM_VARIADIC('*', args, argc)
1548+
ZEND_PARSE_PARAMETERS_END();
15491549

15501550
DOM_GET_THIS_INTERN(intern);
15511551

0 commit comments

Comments
 (0)