teh bigbro blog(tm)
Bigbro's foray into the scary world of blogging

Thu, 24 Aug 2006

Knowing your language...

I'm an advocate of learning how to program without worrying too much about the language implementation - but a small project at work recently reminded me of the benefits of having a pretty good understanding of the featureset available in your chosen language and platform. Sometimes, languages hand you cheap performance improvements on a plate, if you just know to use them.

In a 'couple of hundred lines of perl' script the difference between using an array:
Array:
real 3m3.544s
user 3m3.292s
sys 0m0.210s
and the exact same functionality using a perl hash:
Hash:
real 1m57.281s
user 1m57.043s
sys 0m0.218s
can be pretty significant - about 33% in the example here - and it was a line or two shorter.

Bottom line: a good programmer not only learns how to program in a language agnostic fashion, but also learns what features the implementation languages offers - and uses them.
posted at: 06:40 | path: /technical | permanent link to this entry


copyright © 2005-2008, Gareth Eason