Is this for Linux. Swine, or just for the perls?
(Linux Users or Perl programmers)
Nothing since 27/02.
Martin A. Brooks wrote:
Nothing since 27/02.
Seems to be working fine, guess everyone's had a busy weekend :)
When the list could be empty, which is faster?
if ( @list ) { foreach ( @list ) { } }
- or just -
foreach ( @list ) { }
Or is it a pointless question?
Cheers,
Nigel
On 2 Mar 2009, at 21:01, Nigel Peck wrote:
When the list could be empty, which is faster?
if ( @list ) { foreach ( @list ) { } }
- or just -
foreach ( @list ) { }
Or is it a pointless question?
Yes :)
Benchmark it - but I bet there's not much difference - and the second
version will be
On 2 Mar 2009, at 21:11, Andy Armstrong wrote:
Or is it a pointless question?
Yes :)
Benchmark it - but I bet there's not much difference - and the
second version will be faster in the non-empty case.
Oooh:
$ cat bm-foolish-idea.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Benc
On Mon, Mar 02, 2009 at 09:11:29PM +, Andy Armstrong said:
> Benchmark it - but I bet there's not much difference - and the second
> version will be faster in the non-empty case.
With 1,000,000 iterations
Rate no_ifif
no_if 501961/s-- -2%
if514056/s2%--
With
Andy Armstrong wrote:
Or is it a pointless question?
Yes :)
Thought as much :)
Benchmark it - but I bet there's not much difference - and the second
version will be faster in the non-empty case.
Thanks, that puts this one to bed then :)
Andy Armstrong wrote:
$ perl bm-foolish-idea.pl
Rateempty_foreach empty_if_foreach
empty_foreach 5242880/s -- -74%
empty_if_foreach 20309304/s 287% --
Rate non_empty_if_foreachnon_empt
On Tue, Mar 3, 2009 at 11:02 AM, Nigel Peck wrote:
>
>
> Sorry for the noob questions, but if these are being compared against each
> other, why are the percentages different?
>
>
Basic Math.
50 vs 60 = 50/60 and 60/50 .
50 / 60 = 0.83 and 60/50 = 1.2
1456355 / 1203020
1.2105825339 = 21
Kent Fredric wrote:
Basic Math.
etc..
Thanks :)
On 2 Mar 2009, at 22:02, Nigel Peck wrote:
Andy Armstrong wrote:
$ perl bm-foolish-idea.pl
Rateempty_foreach empty_if_foreach
empty_foreach 5242880/s -- -74%
empty_if_foreach 20309304/s 287% --
12 matches
Mail list logo