Mongolian Death Flu

chaoticset on 2002-03-10T13:31:22

That's what Dave Barry calls the flu-ness where your whole body hurts, and your eyes feel like they've been lit on fire, and half your sinus cavity dries out and is irritated, and the other half is so full you can't breathe through it...

I'll stop now. You probably know what I'm talking about.

I didn't come here to write about that -- I came here to discuss a fairly interesting little experience I had recently.

Looking through The Practice Of Programming while looking to purchase some books on the topic, I came across the most interesting thing; a program done in C, C++, Java, Awk, and Perl, and a table showing how many lines it took and how much time on a P2 233 and a P3 450. I turned it around to show Laura.

The C version took 3 seconds. Java took 4 something, and something was seriously wrong with the C++ version, which took some 11 seconds or so. What surprised her was when I showed her that the Perl one took three times as long as the C one.

"But what's the advantage of Perl over C, then?"

I pointed to the number of lines of C: 150. Then I pointed to the number of lines of Perl: 18.

She cocked her head. I went on to explain about less code = less typos, faster debug time, etc.

I consider it a lesson to me that I both need to learn C (in order to be able to create time-sensitive things) and learn more Perl (in order to work quickly).

I also, unfortunately, am probably going to end up taking a Java class whether I like it or not. Not many language courses are given where I'm going to school.


with room for improvement

jmm on 2002-03-11T16:04:55

As I recall, the perl version in that book had a fair bit of room fo improvement. It was missing a number of idiomatic perl usages; ones that were used in the awk version of the same program and mesntioned as deficiencies in perl.

Re:with room for improvement

chaoticset on 2002-03-11T18:22:47

I didn't actually scan the code itself; for some reason, when I go to bookstores to relax I find myself trying to read as quickly as possible. :\

Maybe, now that I've purchased it, I'll see if I can improve the code significantly.