Help for this page

Select Code to Download


  1. or download this
    my $t1 = timeit(1_000_000, \&odd_1);
    my $t2 = timeit(1_000_000, \&odd_2);
    ...
      my $num = rand(2**31);
      return $num & 1;
    }
    
  2. or download this
    [falkkin@shadow ~/perl] perl odd.pl
    odd_1:  6 wallclock secs ( 6.29 usr + -0.00 sys =  6.29 CPU) @ 158982.
    +51/s (n=1000000)
    odd_2: 10 wallclock secs ( 9.36 usr + -0.01 sys =  9.35 CPU) @ 106951.
    +87/s (n=1000000)