in reply to Re: Python regex faster than Perl?
in thread Python regex faster than Perl?
Thank you for your input, choroba. I've run each of the programs on input generated by your command and it seems that the Perl version does indeed best the Python one. My original input was an expanded form of the Day 3, Advent of Code 2024 input.
So I modified your snippet to run 10000000 iterations, which resulted in a 99MiB file for me. This is similar in size to the original input I used. In doing that, I found that the Perl version again runs slower: 0.626s, to Python's 0.416s.
Can you replicate this? It indicates to me that perhaps Python's regex implementation scales better.
-- edit: Or perhaps Python's interpreter has a larger startup cost and its regex implementation is indeed faster in this case...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Python regex faster than Perl?
by choroba (Cardinal) on Mar 26, 2025 at 16:34 UTC | |
Re^3: Python regex faster than Perl?
by bliako (Abbot) on Mar 26, 2025 at 19:29 UTC | |
Re^3: Python regex faster than Perl?
by LanX (Saint) on Mar 26, 2025 at 18:41 UTC |