On Thu, Oct 23, 2003 at 09:17:24PM -0500, Michael Carman wrote:
> 
> [1] roughly 430 tests in 18 *.t files. Timing done with a wristwatch on a
>     single-user WinXP system.
> 
> I tried it, and it does help some. In my very unscientific test[1] it ran about
> 20% faster. The size of the db file (on disk) was about 75% smaller.

Thanks. 20% is certainly useful.

> I've included a patch for Devel/Cover/DB.pm in case someone else wants to try
> it. It has *not* been sanctioned by Paul (though he's welcome to it) so use at
> your own risk. Obviously, the file format for the database is incompatible with
> the current version.

Has anyone tried this yet? Paul, will you be adopting it?

On a slightly related topic: has anyone tried Devel::DProf (or some
other profiler) with Devel::Cover?  Got any results?
I still don't have time to get into this now but I'd certainly be
interested in seeing dproff output - might just push me over the
edge into working on it some.

Tim.

> -mjc
> 
> *** DB.pm.old Thu Oct 23 14:58:02 2003
> --- DB.pm.new Thu Oct 23 15:00:01 2003
> ***************
> *** 18,25 ****
>   use Carp;
>   use Data::Dumper;
>   use File::Path;
> 
> ! my $DB = "cover.4";  # Version 4 of the database.
> 
>   sub new
>   {
> --- 18,26 ----
>   use Carp;
>   use Data::Dumper;
>   use File::Path;
> + use Storable;
> 
> ! my $DB = "cover.5";  # Version 5 of the database.
> 
>   sub new
>   {
> ***************
> *** 49,65 ****
>           $self->validate_db;
>           $file = "$self->{db}/$DB";
>           return $self unless -e $file;
> !         open F, "<$file" or croak "Unable to open $file: $!";
> !         $self->{filehandle} = *F{IO};
>       }
> 
> -     $self->read if defined $self->{filehandle};
> -
> -     if (defined $file)
> -     {
> -         close F or croak "Unable to close $file: $!";
> -     }
> -
>       croak "No input db, filehandle or cover" unless defined $self->{cover};
> 
>       $self
> --- 50,58 ----
>           $self->validate_db;
>           $file = "$self->{db}/$DB";
>           return $self unless -e $file;
> !         $self->read($file);
>       }
> 
>       croak "No input db, filehandle or cover" unless defined $self->{cover};
> 
>       $self
> ***************
> *** 70,111 ****
>   sub all_criteria       { @{$_[0]->{all_criteria      }} }
>   sub all_criteria_short { @{$_[0]->{all_criteria_short}} }
> 
> ! sub read
> ! {
>       my $self = shift;
> !     local $/;
> !     my $db;
> !     my $fh = $self->{filehandle};
> !     eval <$fh>;
> !     croak $@ if $@;
>       $self->{cover}     = $db->{cover};
>       $self->{collected} = $db->{collected};
>       $self->{indent}    = $db->{indent};
> !     $self
>   }
> 
> ! sub write
> ! {
>       my $self = shift;
>       $self->{db} = shift if @_;
>       croak "No db specified" unless length $self->{db};
>       $self->validate_db;
> !     my $db =
> !     {
>           cover     => $self->{cover},
>           collected => $self->{collected},
>           indent    => $self->{indent},
>       };
> !     local $Data::Dumper::Indent   = $self->indent;
> !     local $Data::Dumper::Sortkeys = 1;
> !     local $Data::Dumper::Useperl  = 1;  # TODO - remove this when possible
> !     my $file = "$self->{db}/$DB";
> !     open OUT, ">$file" or croak "Cannot open $file\n";
> !     print OUT Data::Dumper->Dump([$db], ["db"]);
> !     close OUT or croak "Cannot close $file\n";
> !     $self
>   }
> 
>   sub delete
>   {
>       my $self = shift;
> --- 63,96 ----
>   sub all_criteria       { @{$_[0]->{all_criteria      }} }
>   sub all_criteria_short { @{$_[0]->{all_criteria_short}} }
> 
> ! sub read {
>       my $self = shift;
> !     my $file = shift;
> !     my $db   = retrieve($file);
> !
>       $self->{cover}     = $db->{cover};
>       $self->{collected} = $db->{collected};
>       $self->{indent}    = $db->{indent};
> !     return $self;
>   }
> 
> ! sub write {
>       my $self = shift;
>       $self->{db} = shift if @_;
>       croak "No db specified" unless length $self->{db};
>       $self->validate_db;
> !
> !     my $db = {
>           cover     => $self->{cover},
>           collected => $self->{collected},
>           indent    => $self->{indent},
>       };
> !
> !     Storable::nstore $db, "$self->{db}/$DB";
> !     return $self;
>   }
> 
> +
>   sub delete
>   {
>       my $self = shift;
> 

Reply via email to