Preferences

johnisgood parent
FYI:

  [johnisgood@arch regex]$ hyperfine 'perl regex_test.pl' 'python3 regex_test.py'
  Benchmark 1: perl regex_test.pl
    Time (mean ± σ):      1.807 s ±  0.028 s    [User: 1.752 s, System: 0.054 s]
    Range (min … max):    1.780 s …  1.857 s    10 runs

  Benchmark 2: python3 regex_test.py
    Time (mean ± σ):      3.316 s ±  0.230 s    [User: 3.246 s, System: 0.069 s]
    Range (min … max):    3.052 s …  3.858 s    10 runs

  Summary
    perl regex_test.pl ran
      1.84 ± 0.13 times faster than python3 regex_test.py
This is for a very simple script!

You know why?

Because Perl was practically designed for text processing and regex.

It has:

- A regex engine that's deeply integrated and highly optimized.

- Less overhead (no interpreter startup, minimal memory structures).

- Simpler string substitution and less abstraction.

Seriously, it is not a matter of opinion.

I hope you are convinced now.

In case you are not, let me know, I will let you in on a lot of great details. :)


This item has no comments currently.