Skip to content

Commit 1e2e2f3

Browse files
authored
Refactor some ext/pcre code for performance (#12447)
* Always inline populate_match_value and fix argument type The call overhead of this function is quite large. * Use _new variant of zend_hash in some places to avoid additional check * Move allocation of match_sets down to simplify and reduce code size * Move pcre2_get_ovector_pointer out of the loop This is allocated together with the match data and stays loop invariant: the pointer is always the same (the values not however). * Mark error condition as cold block * Simplify condition: subpats is already checked * Move array size preallocation to use allocate the up-to-date size * Simplify condition * Rework internal functions to avoid repeated unwrapping * Remember Z_ARRVAL_P(return_value) The lookup is loop invariant. * Mark some pointers as const
1 parent 191966b commit 1e2e2f3

File tree

1 file changed

+79
-69
lines changed

1 file changed

+79
-69
lines changed

0 commit comments

Comments
 (0)