summaryrefslogtreecommitdiff
path: root/lib/Benchmark.pm
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-08-07 14:43:57 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-08-07 14:43:57 +0000
commit359218de2862c98ccfadd5880b5a17387de633db (patch)
tree0f814cad8a75ba2e6531f911c1ec31eb756452f9 /lib/Benchmark.pm
parent0a8c84970ed40ea8edae407334b845cdf5015c50 (diff)
downloadperl-359218de2862c98ccfadd5880b5a17387de633db.tar.gz
[PATCH 5.8.1] Benchmark problem
From: Radu Greab <rgreab@fx.ro> Date: Thu, 07 Aug 2003 16:18:25 +0300 (EEST) Message-Id: <20030807.161825.106541372.radu@yx.primIT.ro> Subject: Re: [PATCH 5.8.1] Benchmark problem From: Rafael Garcia-Suarez <rgarciasuarez@free.fr> Date: Thu, 7 Aug 2003 15:48:38 +0200 Message-Id: <20030807154838.5d240dbb.rgarciasuarez@free.fr> p4raw-id: //depot/perl@20546
Diffstat (limited to 'lib/Benchmark.pm')
-rw-r--r--lib/Benchmark.pm37
1 files changed, 8 insertions, 29 deletions
diff --git a/lib/Benchmark.pm b/lib/Benchmark.pm
index 3d154bc321..0ca7c59e4f 100644
--- a/lib/Benchmark.pm
+++ b/lib/Benchmark.pm
@@ -440,7 +440,7 @@ my $hirestime;
sub mytime () { time }
-&init;
+init();
sub BEGIN {
if (eval 'require Time::HiRes') {
@@ -470,8 +470,8 @@ sub init {
# The cache can cause a slight loss of sys time accuracy. If a
# user does many tests (>10) with *very* large counts (>10000)
# or works on a very slow machine the cache may be useful.
- &disablecache;
- &clearallcache;
+ disablecache();
+ clearallcache();
}
sub debug { $Debug = ($_[1] != 0); }
@@ -482,43 +482,22 @@ sub usage {
return $_Usage{$calling_sub} || '';
}
-
# The cache needs two branches: 's' for strings and 'c' for code. The
-# emtpy loop is different in these two cases.
+# empty loop is different in these two cases.
-$_Usage{clearcache} = <<'USAGE';
-usage: clearcache($count);
-USAGE
-
-sub clearcache {
- die usage unless @_ == 1;
+sub clearcache ($) {
delete $Cache{"$_[0]c"}; delete $Cache{"$_[0]s"};
}
-$_Usage{clearallcache} = <<'USAGE';
-usage: clearallcache();
-USAGE
-
-sub clearallcache {
- die usage if @_;
+sub clearallcache () {
%Cache = ();
}
-$_Usage{enablecache} = <<'USAGE';
-usage: enablecache();
-USAGE
-
-sub enablecache {
- die usage if @_;
+sub enablecache () {
$Do_Cache = 1;
}
-$_Usage{disablecache} = <<'USAGE';
-usage: disablecache();
-USAGE
-
-sub disablecache {
- die usage if @_;
+sub disablecache () {
$Do_Cache = 0;
}