I think you can try the Benchmark module. Like:

    use Benchmark qw(:all) ;

    $line = ABCDEFGHIJKLMNOPQRSTUVWXYZ';
   
    $r = timethese(1000000, {
        'CASE 1'    => 
                        sub
                        {
                              $line =~ /\w*\w*\w*/;
                        },
        'CASE 2'  =>
                        sub
                        {
                              $line =~ /\w/g;
                        },
     });

Good Luck!


From: "Robert Killheffer" <[EMAIL PROTECTED]>
To: <[email protected]>
Subject: System resources used by Perl script
Date: Tue, 14 Mar 2006 07:41:06 -0500

I’m testing several different algorithms for performing the same task, and I’m wondering if there is some way I can tell – from within each version of my script – how much memory and CPU time the script uses each time it runs.

 

I would like to be able to output this information to a log, so that I can compare these values for the different scripts across a period of time.

 

I’d be grateful for any suggestions.

 

Thanks,

Rob K.

 


>_______________________________________________
>Perl-Win32-Users mailing list
>[email protected]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to