Skip to content

Regression in re.compile() performance #161125

Open

Description

@eendebakpt

Bug report

The pyperformance regex_compile benchmark is 1.17x slower on main than on 3.15 (1.19x on the free-threaded build). Bisecting points at the gh-152100 series (GH-152153, GH-152154, GH-152214). The regression is also visible on regex_compile on speed.python.org

The reason is redundant work in the case that no fusable constructs are present. Claude has several suggestions, one is in https://github.com/eendebakpt/cpython/tree/re-optimizer-skip-pass.

@serhiy-storchaka

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    performancePerformance or resource usage
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 1, 2026
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

    performancePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions