# New Ticket Created by Mark Glines # Please include the string: [perl #44809] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=44809 >
With ccache, HEAD rebuilds for me in a little less than 3 minutes. (2:57, on average.) With this patch, parrot rebuilds for me in 1 minute 41 seconds, plus or minus a few seconds. That's almost 80 seconds faster; a 45% improvement in build time. For reference, I also tried YAML::Syck, which built in 1 minute 55 seconds. But Storable is in the perl base install, and its even faster. Eval sucks. Are there any drawbacks to this patch? The only thing I can think of is that its harder to read the .dump file now that it's binary. But it wasn't terribly well organized to begin with... Mark
Index: lib/Parrot/Pmc2c/Pmc2cMain.pm =================================================================== --- lib/Parrot/Pmc2c/Pmc2cMain.pm (revision 20738) +++ lib/Parrot/Pmc2c/Pmc2cMain.pm (working copy) @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use Data::Dumper; +use Storable; use Parrot::Vtable; use Parrot::PMC; use Parrot::Pmc2c::VTable; @@ -226,7 +226,7 @@ $self->read_dump('filename'); B<Purpose:> A F<.dump> file is the result of a call to C<dump_pmc()> and -consists of a print-out of a hash reference Data::Dumper-style. +consists of a binary dump of a hash reference, Storable-style. C<read_dump()> reads in the F<.dump> file, recreates the data structure and returns a new hash reference holding the data structure. @@ -248,9 +248,7 @@ my ( $self, $filename ) = @_; $filename = $self->find_file( filename($filename, '.dump'), 1 ); - my $class; - eval do { slurp($filename); }; - die $@ if $@; + my $class = retrieve($filename) if -f $filename; return $class; } Index: lib/Parrot/Pmc2c/VTable.pm =================================================================== --- lib/Parrot/Pmc2c/VTable.pm (revision 20738) +++ lib/Parrot/Pmc2c/VTable.pm (working copy) @@ -5,7 +5,7 @@ use warnings; use base qw( Exporter ); our @EXPORT_OK = qw(); -use Data::Dumper; +use Storable; use Parrot::Vtable; use Parrot::Pmc2c::Method; use Parrot::Pmc2c::UtilFunctions qw(spew); @@ -73,9 +73,7 @@ my $dump_filename = cwd() . q{/} . basename( Parrot::Pmc2c::UtilFunctions::filename($self->filename, '.dump') ); - my $Dumper = Data::Dumper->new( [$self], ['class'] ); - $Dumper->Indent(3); - spew($dump_filename, $Dumper->Dump); + store($self, $dump_filename); return $dump_filename; } Index: lib/Parrot/Pmc2c/PMC.pm =================================================================== --- lib/Parrot/Pmc2c/PMC.pm (revision 20738) +++ lib/Parrot/Pmc2c/PMC.pm (working copy) @@ -25,7 +25,7 @@ use warnings; use base qw( Exporter ); our @EXPORT_OK = qw(); -use Data::Dumper; +use Storable; use Parrot::PMC; use Parrot::Pmc2c::UtilFunctions qw(spew); use Parrot::Pmc2c::Method; @@ -61,9 +61,7 @@ #gen_parent_lookup_info( $self, $pmc2cMain, $pmcs ); #gen_parent_reverse_lookup_info( $self, $pmcs, $vtable_dump ); - my $Dumper = Data::Dumper->new( [$self], ['class'] ); - $Dumper->Indent(1); - spew($self->filename('.dump'), $Dumper->Dump); + store($self, $self->filename('.dump')); } #methods Index: config/gen/makefiles/dynpmc_pl.in =================================================================== --- config/gen/makefiles/dynpmc_pl.in (revision 20738) +++ config/gen/makefiles/dynpmc_pl.in (working copy) @@ -17,6 +17,10 @@ use warnings; use File::Copy qw(copy); +use FindBin; +use lib "$FindBin::Bin/../.."; +use lib "$FindBin::Bin/../../lib"; +use Storable; # q[] isn't guaranteed to work, but it's safer than "" as some platforms # (eg FreeBSD) have ""s embedded in their substution values. q[] is used @@ -189,8 +193,7 @@ my ( %group_files, %group_libs, %pmc_group, %pmc_libs ); for my $pmc (@pmcs) { - our $class; - require "$pmc.dump"; + our $class = retrieve("$pmc.dump"); # there can be many libs my %libs = %{ $class->{flags}{lib} || {} };