As I make my daily treks to the gates to learn/help where I can, I have noticed something...The majority of perl users/developers use perl for about everything except what the language letters stand for Practical Extraction and Reporting Language. We have entire websites run by perl, database applications, automation sequences, obfuscation , data munging, whatever.. I say all of that to bring this thought...Because Perl is so flexible, and can do just about anything we need it to, and a lot of us are most comfortable when coding in perl, does it necessarily make perl the end-all-be-all language. What forces us to NOT use perl? Another note I have is this...many of us have 'standard' stuff that we do everyday in perl, or a standard way of reading in files, or doing this or doing that, and some of it is probably a LOT more efficient than the way that I currently do stuff...and it is stuff that you can't necessarily put in a 'module' to share with the world, its just part of your coding nature.. So as to not open flame wars, or pandora's box, or anyother bad nasty thing...I thought maybe we could share with each other our 'best practices'..Obviously this couldn't be done at the language level, otherwise it would get really hairy, and wouldn't be of much use... So how about data munging...
take me for example...when reading in a fixed width file, I ALWAYS use pack and unpack instead of substr...why? because substr is SLOW, and I can parse the entire record at once instead of one field at a time.
When tie'ing hashes to a file with DB_File, I always use $DB_BTREE instead of $DB_HASH, because the search time to hit the hash seems to be faster when dealing with multi-million record files. I could be totally wrong and not know it too..
what else...
is for faster than foreach? dunno, never benchmarked it...anyone know?
is
As you can see I am looking for simple stuff here...nothing funky that is hard to interpret, just perl basics that we take forgranted sometimes in thinking that everyone knows about them.
Thanks in advance Robert
take me for example...when reading in a fixed width file, I ALWAYS use pack and unpack instead of substr...why? because substr is SLOW, and I can parse the entire record at once instead of one field at a time.
When tie'ing hashes to a file with DB_File, I always use $DB_BTREE instead of $DB_HASH, because the search time to hit the hash seems to be faster when dealing with multi-million record files. I could be totally wrong and not know it too..
what else...
is for faster than foreach? dunno, never benchmarked it...anyone know?
is
fasther thanmy $num_elements=@array;
my $num_elements=$#array;
As you can see I am looking for simple stuff here...nothing funky that is hard to interpret, just perl basics that we take forgranted sometimes in thinking that everyone knows about them.
Thanks in advance Robert
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Reporting
by dragonchild (Archbishop) on Apr 03, 2003 at 18:13 UTC | |
by t'mo (Pilgrim) on Apr 04, 2003 at 16:18 UTC | |
by PhilHibbs (Hermit) on Sep 10, 2004 at 08:56 UTC | |
Re: Reporting
by perrin (Chancellor) on Apr 03, 2003 at 17:47 UTC | |
Re: Reporting
by chromatic (Archbishop) on Apr 03, 2003 at 20:47 UTC | |
Re: Reporting
by dga (Hermit) on Apr 03, 2003 at 18:16 UTC | |
by dmitri (Priest) on Apr 03, 2003 at 22:49 UTC | |
Re: Reporting
by kelan (Deacon) on Apr 03, 2003 at 18:28 UTC | |
by dragonchild (Archbishop) on Apr 03, 2003 at 19:10 UTC | |
by diotalevi (Canon) on Apr 04, 2003 at 00:59 UTC | |
by l2kashe (Deacon) on Apr 04, 2003 at 05:54 UTC | |
Re: Reporting
by Anonymous Monk on Apr 03, 2003 at 22:48 UTC | |
Re: Reporting
by Anonymous Monk on Apr 04, 2003 at 03:49 UTC | |
Re: Reporting
by aquarium (Curate) on Apr 04, 2003 at 11:27 UTC | |
Re: Reporting
by l2kashe (Deacon) on Apr 04, 2003 at 05:50 UTC |
Back to
Meditations