Skip to content

Commit

Permalink
Use fast ZPP for ParentNode manipulation methods (php#14981)
Browse files Browse the repository at this point in the history
These are very common, and parsing variadic arguments takes a very long
time, so this optimization makes sense to do.
  • Loading branch information
nielsdos authored Jul 16, 2024
1 parent f58a3c3 commit 251b789
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions ext/dom/element.c
Original file line number Diff line number Diff line change
Expand Up @@ -1453,9 +1453,9 @@ PHP_METHOD(DOMElement, after)
zval *args;
dom_object *intern;

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

DOM_GET_THIS_INTERN(intern);

Expand All @@ -1468,9 +1468,9 @@ PHP_METHOD(DOMElement, before)
zval *args;
dom_object *intern;

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

DOM_GET_THIS_INTERN(intern);

Expand All @@ -1486,9 +1486,9 @@ PHP_METHOD(DOMElement, append)
zval *args;
dom_object *intern;

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

DOM_GET_THIS_INTERN(intern);

Expand All @@ -1505,9 +1505,9 @@ PHP_METHOD(DOMElement, prepend)
zval *args;
dom_object *intern;

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

DOM_GET_THIS_INTERN(intern);

Expand All @@ -1524,9 +1524,9 @@ PHP_METHOD(DOMElement, replaceWith)
zval *args;
dom_object *intern;

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

DOM_GET_THIS_INTERN(intern);

Expand All @@ -1543,9 +1543,9 @@ PHP_METHOD(DOMElement, replaceChildren)
zval *args;
dom_object *intern;

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

DOM_GET_THIS_INTERN(intern);

Expand Down

0 comments on commit 251b789

Please sign in to comment.