Michael Buffington

Perl on a Mac = Slow?

Thursday, July 08 2004

I’m about to get technical, have no fear.

For the past week and a half I’ve been trying my hand at learning Perl. For a few days I was seriously stumped. The code uses more punctuation than it does alpha-numeric characters, and can be super difficult to understand. Yesterday I had a breakthrough of sorts. I was able to read a huge text file, split it into an array, and drop it into a MySQL database. For me, that’s a big step.

But I got to thinking – could I do it quicker using ColdFusion? What took me over a week in Perl to create took me about 20 minutes to create in ColdFusion (which should be unsurprising – I’ve been writing ColdFusion code for nearly 9 years now, and Perl for 9 days). As it turns out, I used ColdFusion and Java to pull the file in, and it took CF+Java 3 seconds to do what Perl did in 16 seconds.

Knowing that Perl is supposed to be super good at handling text files, I had a friend who knows Perl well test out the code I’d written in Perl on his machine, and it ran in a second or less.

So, I declare – there’s something wrong with Perl on my Mac. After more testing, it appears that any time I try to access a file on the Mac with Perl, it takes at least 10 seconds, no matter what I do with it. I’m curious if other Mac users have seen this issue with OS X and Perl as well.