old code revisitedby neophyte (Curate)
|on Sep 08, 2001 at 17:23 UTC||Need Help??|
In the section Q&A under Is there a shorter way to create a german time string? I posted some code that's still running in some of my older scripts. Yesterday I got back to the snippet in a printed version and wondered.
I knew I did a benchmark with using localtime and Date::Manip and performance didn't differ significantly for me. Now I still wondered if I could make that code more efficient.
So I tried the following benchmark:
The result was (as I had expected)
on a WinME with ActivePerl Build 628. I also tested it on a FreeBSD 4.0, Perl 5.005 on an old notebook, where the difference was even more significant.
So this is to show - never trust old code. Don't get into the habit of copy and paste.
Make it a habit to review old code, It'll do your code and your coding expertise good.
It already has helped me gain some insights - and I'm sure it'll continue doing so.