| Next | Making Programs Faster | 26 |
Since 5.7.2, Perl has come with the Time::HiRes module
Time::HiRes overloads time and sleep to have finer resolution
use LWP::Simple 'get';
use Time::HiRes 'time';
my $url= shift;
my $start = time();
my $doc = get($url);
my $elapsed = time() - $start;
print "$elapsed second(s) elapsed.\n";
1.49982798099518 second(s) elapsed.
Time::HiRes is also available from CPAN
It also provides high-resolution versions of sleep and alarm
Also other high-resolution time-related functions
| Next | ![]() |
Copyright © 2003 M. J. Dominus |