in reply to Python regex faster than Perl?
perl -wE 'for (1..10000) { print int(rand 2) ? "xyzabcd" : ("mul(" . i +nt(rand 5000). "," . int(rand 5000) . ")" ) ; print "\n" unless int r +and 10 }' > 1
I then ran the two programs. Note that the one labelled "PYTHON" is in fact the Perl one, and vice versa.
These were my results:
time python3 1.py 1 Found 200 matches. real 0m0.027s user 0m0.018s sys 0m0.005s $ time 1.pl 1 Found 200 matches. real 0m0.006s user 0m0.004s sys 0m0.000s
YMMV.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Python regex faster than Perl?
by dave93 (Acolyte) on Mar 26, 2025 at 16:09 UTC | |
by choroba (Cardinal) on Mar 26, 2025 at 16:34 UTC | |
by bliako (Abbot) on Mar 26, 2025 at 19:29 UTC | |
by LanX (Saint) on Mar 26, 2025 at 18:41 UTC |