This largely (at the moment) comes down to trial and error for me - which is *very* frustrating - hence this Meditation .. me trying to put thoughts down on paper - scary thought .. :P I'm sure this is something that comes up a lot .. but I thought I'd post it anyway, and see what comes of it.
Perl is flexible. Very flexible. To the point that, for any given task, you can all but guarantee that there's a completely different, and probably better, way to do it.
This is one of Perl's best features - but also one of it's most frustrating. Even with the most carefully crafted code, I find myself wondering if I could have done it some other way to shave valuable minutes off of processing the million-or-so data records coming out of the database.
Bizarrely, to me at least, coming from a C background, where there's rarely more than one "recommended" way to do something, few of the "good" Perl books seem to touch on code effiency, barring a quick "there's more than one way to do something" comment in the introductory paragraph/chapter of the book.
Surely for something this fundamental - runtimes of scripts can be multipled many times with a less "efficient" method of processing - some guidelines should exist - even if it were just a quick "tip-sheet" to give you a helping hand when figuring out how not to write a script.
I can see that there's really no restrictions on how code is written - and it's largely a matter of personal style, preference and experience ..
What I'm interested to know is ...
- how do other Monks go about optimising their code?
- when faced with more than one obvious way to do something, what's the determining factor?
- surely this has to be more than "trial and error" ..? *grin*
Anyway .. enough of my thoughts/contemplations/moaning .. just thought I'd see what people thought.
--Foxcub
In reply to Code Efficiency: Trial and Error? by Tanalis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |