Help for this page

Select Code to Download


  1. or download this
    use Benchmark;
    $a="Hello";
    timethese(10_000_000, { eq => sub { return ($a eq "" || $a eq "?") },
                             regexp => sub { $a=~/^\??$/ } } );
    
  2. or download this
    Benchmark: timing 10000000 iterations of eq, regexp...
            eq:  7 wallclock secs ( 3.51 usr + -0.01 sys =  3.50 CPU) @ 28
    +57142.86/s (n=10000000)
        regexp: 22 wallclock secs (10.15 usr +  0.13 sys = 10.28 CPU) @ 97
    +2762.65/s (n=10000000)