2 ms·
After spending some time with Python, I think one of the secrets to Perl's great performance is that nothing ever seems to get "stuck" in Perl like the way cert
by bane 11y ago
After spending some time with Python, I think one of the secrets to Perl's great performance is that nothing ever seems to get "stuck" in Perl like the way certain code patterns can be written in Python or written a different way to make use of some C optimization "behind the scenes". With Perl, it seems like it always just tries to use a C optimization whenever it's supposed to and you don't have to think about it too much.
The other thing is that Perl's built in data structure primitives have somehow hit a magical balance between performance, ease of use and power. Once you get used to the syntax, arbitrarily composing complex data structures is super-easy and they usually perform extremely well.
I think what's surprising is how snappy the language feels in aggregate, even if it benchmarks fairly slow. From execution to runtime, it just feels snappy and I think that may give it a false sense of performance while modern Java and C++ etc. really are faster, they have a clunky feel and lots of the user-facing things seem kind of creaky.
One other problem is that it's really easy to write really slow code in other languages, but even if you only do things mildly "the Perl way" it'll still run reasonably quick.
To this day, I'm still amazed at how many little Perl prototype projects I've written that outperformed their compiled rewrite cousins for months until lots of time was spent specifically tuning that rewritten code.
edit sorry for words I'm beer-posting tonight