Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Being more Assert-ive with Perl

by stvn (Monsignor)
on Sep 18, 2004 at 15:58 UTC ( [id://392001]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    
    ...
        'CarpAssert' => sub { eval { CarpAssert($_) } for (@nums) },    
        'OrAssert'   => sub { eval { OrAssert($_)   } for (@nums) },   
    });
    
  2. or download this
    Benchmark: timing 10000 iterations of CarpAssert, OrAssert...
    CarpAssert: 11 wallclock secs ( 9.92 usr +  0.04 sys =  9.96 CPU) @ 10
    +04.02/s (n=10000)
    ...
                 Rate CarpAssert   OrAssert
    CarpAssert 1004/s         --       -28%
    OrAssert   1395/s        39%         --
    
  3. or download this
    Benchmark: timing 10000 iterations of CarpAssert, OrAssert...
    CarpAssert:  9 wallclock secs ( 6.50 usr +  0.03 sys =  6.53 CPU) @ 15
    +31.39/s (n=10000)
    ...
                 Rate   OrAssert CarpAssert
    OrAssert   1484/s         --        -3%
    CarpAssert 1531/s         3%         --
    
  4. or download this
    sub noOpError {}
    sub OrAssert {
    ...
        ($test < 50) || noOpError("Test is wrong");
        return $test;
    }
    
  5. or download this
    Benchmark: timing 10000 iterations of CarpAssert, OrAssert...
    CarpAssert:  6 wallclock secs ( 6.54 usr +  0.00 sys =  6.54 CPU) @ 15
    +29.05/s (n=10000)
    ...
                 Rate   OrAssert CarpAssert
    OrAssert   1403/s         --        -8%
    CarpAssert 1529/s         9%         --
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://392001]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (9)
As of 2024-04-23 08:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found