Skip to content

Cache PCRE named group names #14423

Closed
@mvorisek

Description

@mvorisek

Description

I have discovered PCRE preg_match is at least twice as slow when using named groups.

PCRE internally remaps named groups to indexes, so the slowdown is comming from php-src.

I belive the reason is the named group names zvals are created each time the preg_match is run.

I propose to improve the performance by caching the names zvals in the regex cache entry - https://github.com/php/php-src/blob/php-8.3.7/ext/pcre/php_pcre.c#L55

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions