Skip to content

Slow compilation for big bytes pattern  #657

Closed
@Alphare

Description

@Alphare

As promised in #524, I'm opening this issue because I found a difference in performance between Re2 (with custom bindings) and regex when compiling the regex itself.

Here is the example:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=eb83255739973d40d16997574ba9dd35

These are the exact bytes that are constructed after parsing Netbeans' old .hgignore and this is the exact way I am using them.

regex takes about 5ms to build the regex while Re2 takes about 1ms on a very stable, 4 core machine.

I cannot offer you an easy reproduction for Re2, however should you want to try to see the difference within Mercurial I can help.

I am using rustc version 1.34.2 and regex version 1.3.5 on a Linux amd64 machine.

Note: I've also seen a small performance difference when using is_match in Mercurial's working directory traversal code, but that is a separate issue probably.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions