> >Testers welcome!
I am not seeing a difference on Windows.
A fairly large (~5MB) application was created. Just counting in my
head, comparing the same previously created application with the newly
created one, I am not seeing a difference. The initial
unbundling/execution takes about ten seconds for each. The subsequent
ones take about 3 seconds for each.
I installed svn, then did
svn checkout http://svn.openfoundry.org/par/trunk
I did the install.
A fairly large (~5MB) application was created to compare with one made
last week ago. Just counting in my head, comparing the same previously
created application with the newly created one, I am not seeing a
difference. The initial unbundling/execution takes about ten seconds
for each. The subsequent ones take about 3 seconds for each.
I have never used svn before, so let me paste the PAR.pm diffs just so
Steffen can determine if I have the right PAR.pm file.
>diff PAR.pm_old PAR.pm_new > diff_old_new.txt
----------paste diff_old_new.txt
9a10,26
> # If the 'prefork' module is available, we
> # register various run-time loaded modules with it.
> # That way, there is more shared memory in a forking
> # environment.
> BEGIN {
> if (eval 'require prefork') {
> prefork->import($_) for qw/
> Archive::Zip
> File::Glob
> File::Spec
> File::Temp
> LWP::Simple
> PAR::Heavy
> /;
> }
> }
>
244a262,264
> use vars qw(%FileCache); # The Zip-file file-name-cache
> # Layout:
> # $FileCache{$ZipObj}{$FileName}
= $Member
348a369
>
454a476,479
> # Given an Archive::Zip obj and a list of files/paths,
> # this function returns the Archive::Zip::Member for the
> # first of the files found in the ZIP. If none is found,
> # returns the empty list.
457,459d481
< my %names = map { ( $_->fileName => $_ ) } $zip->members;
< my %lc_names;
< %lc_names = map { ( lc($_->fileName) => $_ ) } $zip->members if
$is_insensitive_fs;
461,462c483,484
< return $names{$name} if $names{$name};
< return $lc_names{lc($name)} if $is_insensitive_fs and
$lc_names{lc($name)};
---
> my $member = _cached_member_named($zip, $name);
> return $member if $member;
495a518,523
> # FIXME: What the hell is the following code doing?
> # There is a "use Config '%Config'" at the top of PAR.pm
> # I'll probably replace it by
> # my $dlext = defined($Config{dlext}) ? $Config{dlext} : '';
> # eventually!
> # -- Steffen
598a627
> delete $FileCache{$par};
632a662
> # URL use case ==> download
639a670
> # prepare cache directory
647a679,684
> # Munge URL into local file name
> # FIXME: This might result in unbelievably long file names!
> # I have run into the file/path length limitations of linux
> # with similar code in PAR::Repository::Client.
> # I suspect this is even worse on Win32.
> # -- Steffen
655a693
>
658c696
< return unless -e $file;
---
> return unless -e $file and -f _;
660a699
> # Got the .par as a string. (reference to scalar, of course)
665a705,706
> # If the par is not a valid .par file name and we're being strict
> # about this, then also check whether "$par.par" exists
691a733
> $FileCache{$_[0]} = _make_file_cache($zip);
693c735
< foreach my $member ( $zip->membersMatching(
---
> foreach my $member ( _cached_members_matching($zip,
706c748
< foreach my $member ( $zip->membersMatching(
---
> foreach my $member ( _cached_members_matching( $zip,
904a947,995
> # Given an Archive::Zip object, this generates a hash of
> # file_name_in_zip => file object
> # and returns a reference to that.
> # If we broke the encapsulation of A::Zip::Member and
> # accessed $member->{fileName} directly, that would be
> # *significantly* faster.
> sub _make_file_cache {
> my $zip = shift;
> if (not ref($zip)) {
> croak("_make_file_cache needs an Archive::Zip object as
argument.");
> }
> my $cache = {};
> foreach my $member ($zip->members) {
> $cache->{$member->fileName()} = $member;
> }
> return $cache;
> }
>
> # given an Archive::Zip object, this finds the cached hash
> # of Archive::Zip member names => members,
> # and returns all member objects whose file names match
> # a regexp
> # Without file caching, it just uses $zip->membersMatching
> sub _cached_members_matching {
> my $zip = shift;
> my $regex = shift;
>
> my $cache = $FileCache{$zip};
> $cache = $FileCache{$zip} = _make_file_cache($zip) if not $cache;
>
> return map {$cache->{$_}}
> grep { $_ =~ $regex }
> keys %$cache;
> }
>
> # access named zip file member through cache. Fall
> # back to using Archive::Zip (slow)
> sub _cached_member_named {
> my $zip = shift;
> my $name = shift;
>
> my $cache = $FileCache{$zip};
> $cache = $FileCache{$zip} = _make_file_cache($zip) if not $cache;
> return $cache->{$name};
> }
>
>
>
>
926a1018,1021
>
> PAR supports the L<prefork> module. It declares various run-time
> dependencies so you can use the L<prefork> module to get streamlined
> processes in a forking environment.
----------end paste diff_old_new.txt