Benchmarking [was] Re: Not Matt's Scripts

2001-03-27 Thread Simon Wilcox
At 13:29 27/03/2001 +, Matthew Byng-Maddick wrote: my @th=(qw(th st nd rd),("th")x16)x2; $th[31]="st"; That's an evil and gross hack. [snip] sub th{(($_[0]-10-$_[0]%10)/10%10)?(qw(th st nd rd),('th')x6)[$_[0]%10]:"th"} The first one I understood. Not sure about the second but I'll work

Re: Benchmarking [was] Re: Not Matt's Scripts

2001-03-27 Thread Philip Newton
Simon Wilcox wrote: So - Did I get this heinously wrong or is MBM's sub really a lot slower ? Well, remember that the sub effecticaly recalculates (what amounts to) the array each time. To be fair, you should include the array initialisation inside the loop and see who wins then. Cheers,

Re: Benchmarking [was] Re: Not Matt's Scripts

2001-03-27 Thread David Cantrell
On Tue, Mar 27, 2001 at 04:19:08PM +0100, Simon Wilcox wrote: I thought I would play around with Benchmark.pm, because I don't use it nearly often enough, so I made this script: @th=(qw(th st nd rd),("th")x16)x2; $th[31]="st"; sub th{(($_[0]-10-$_[0]%10)/10%10)?(qw(th st nd

Re: Benchmarking [was] Re: Not Matt's Scripts

2001-03-27 Thread Robin Houston
On Tue, Mar 27, 2001 at 05:40:19PM +0200, Philip Newton wrote: Well, remember that the sub effecticaly recalculates (what amounts to) the array each time. To be fair, you should include the array initialisation inside the loop and see who wins then. Hey, that's not _fair_! The whole point of

Re: Benchmarking [was] Re: Not Matt's Scripts

2001-03-27 Thread Simon Wilcox
At 16:53 27/03/2001 +0100, Robin Houston wrote: On Tue, Mar 27, 2001 at 05:40:19PM +0200, Philip Newton wrote: Well, remember that the sub effecticaly recalculates (what amounts to) the array each time. To be fair, you should include the array initialisation inside the loop and see who wins

Re: Benchmarking [was] Re: Not Matt's Scripts

2001-03-27 Thread Matthew Byng-Maddick
On Tue, 27 Mar 2001, Simon Wilcox wrote: At 16:53 27/03/2001 +0100, Robin Houston wrote: On Tue, Mar 27, 2001 at 05:40:19PM +0200, Philip Newton wrote: Well, remember that the sub effecticaly recalculates (what amounts to) the array each time. To be fair, you should include the array