Skip to content

Parsing '[ (]([ (]([ (]([ (](...' takes quadratic time #285

@mity

Description

@mity
$ time py -c 'print("[ (](" * 10000)' | ./cmark >/dev/null
real    0m0.232s
user    0m0.030s
sys     0m0.000s

$ time py -c 'print("[ (](" * 40000)' | ./cmark >/dev/null
real    0m2.168s
user    0m0.000s
sys     0m0.045s

$ time py -c 'print("[ (](" * 80000)' | ./cmark >/dev/null
real    0m8.278s
user    0m0.016s
sys     0m0.046s

(Originally reported by @andersk for MD4C in mity/md4c#57 but applies to Cmark too.)

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