Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^4: How to get minimum start date in these start dates ?by johngg (Canon) |
on Jul 10, 2006 at 15:42 UTC ( [id://560168]=note: print w/replies, xml ) | Need Help?? |
I agree with you cog regarding the the ST over the OM but that's probably because I've never used the OM in anger so I'm not familiar with it. I think that both JediWizard's solution and yours overcomplicate the transformation of the date into a sortable form. Just reversing the date to sort it and then reversing it again to extract it seems much simpler and quicker to me. I have done some benchmarking which seems to bear this out. I've also corrected a couple of typos (you had missed a closing quote in one of your hash keys but I've unquoted them all and JediWizard had doubled his quote words like qw(qw( ... )). Here is the code
And these are the results
Looks like your hunch about speed was correct in that you and JediWizard pan out about the same (seems to go either way over several runs but the one I captured here was a dead heat). However, my simpler solution appears to be consistently quicker. I hope this is of interest. Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|