Skip to content

Regex is slow #30

Description

@agulabon11

The preg_match() in line 452 can be slow in PHP 7.4 (not in 8.1 afaict).

Sometimes it takes seconds to minutes to parse.

if (!preg_match('`^(/?)([a-z][^ >]*)([^>]*)>(.*)`sm', $t[$i], $m)) {

For some reason it struggles with a sequence of many short lines (100 lines, 10 characters each), followed by a sequence of very long lines (10 lines, 10k long each).
That sequence takes more than 1 minute to parse.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions