Skip Menu |

This queue is for tickets about the Archive-Tar CPAN distribution.

Report information
The Basics
Id: 17624
Status: resolved
Priority: 0/
Queue: Archive-Tar

People
Owner: Nobody in particular
Requestors: cpan.org [...] in-addr.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.28
Fixed in: (no value)



Subject: Unnecessary calls to cwd()
On line 493 of Archive-Tar-1.28/lib/Archive/Tar.pm, there is the following call: my $cwd = cwd(); The Cwd library calls the '/bin/pwd' binary on most Unix systems. This is a relatively expensive call involving fork() and exec(). However, if the full path is supplied to the extract_file method, then the cwd() call is unnecessary as the data is discarded without being used. Suggestion: Move the cwd() call inside the "else" clause at line 515. e.g. ### it's a relative path ### } else { my $cwd = cwd(); my @dirs = File::Spec::Unix->splitdir( $dirs ); my @cwd = File::Spec->splitdir( $cwd ); $dir = File::Spec->catdir( @cwd, @dirs ); This simple optimisation can significantly speed up file extraction
Thanks for the tip. This has been fixed with: Change 12383 submitted.