Skip to content

Commit dc47b99

Browse files
kaja47nikic
authored andcommitted
SplHeap: replace zend_parse_parameters with ZEND_PARSE_PARAMETERS* macros
this change alone speeds up top-k computation significantly
1 parent 765cb40 commit dc47b99

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

ext/spl/spl_heap.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,9 @@ PHP_METHOD(SplHeap, insert)
590590
zval *value;
591591
spl_heap_object *intern;
592592

593-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &value) == FAILURE) {
594-
RETURN_THROWS();
595-
}
593+
ZEND_PARSE_PARAMETERS_START(1, 1)
594+
Z_PARAM_ZVAL(value);
595+
ZEND_PARSE_PARAMETERS_END();
596596

597597
intern = Z_SPLHEAP_P(ZEND_THIS);
598598

@@ -638,9 +638,10 @@ PHP_METHOD(SplPriorityQueue, insert)
638638
spl_heap_object *intern;
639639
spl_pqueue_elem elem;
640640

641-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &data, &priority) == FAILURE) {
642-
RETURN_THROWS();
643-
}
641+
ZEND_PARSE_PARAMETERS_START(2, 2)
642+
Z_PARAM_ZVAL(data);
643+
Z_PARAM_ZVAL(priority);
644+
ZEND_PARSE_PARAMETERS_END();
644645

645646
intern = Z_SPLHEAP_P(ZEND_THIS);
646647

0 commit comments

Comments
 (0)