Categories
Posts

Underestimating Perl

Rafe Colburn on Perl outperforming sed and awk:

There are a couple of lessons here. The first is that when you’re doing simple text processing, you may as well just use Perl one-liners. The idea that sed and awk are superior because they are smaller and simpler is not borne out by real-world results. (They may be faster for some things, but it’s clearly no sure thing.) Perl is mature and is obviously highly optimized.

The second is that while premature optimization may be the root of all evil, when you’re performing the same operation billions of times, even very small gains in efficiency can have huge impact. When the CPU on the server was pegged at 100% for a few days and the load average spiked at over 200, every gain in efficiency became hugely important.

I’ve sliced and diced a lot of text with Perl ( mostly many years ago ), it will always have a fond place in my heart. The one-liner abilities are legendary.