Skip Menu |

This queue is for tickets about the Module-Load-Conditional CPAN distribution.

Report information
The Basics
Id: 53546
Status: resolved
Worked: 30 min
Priority: 0/
Queue: Module-Load-Conditional

People
Owner: BINGOS [...] cpan.org
Requestors: zwon [...] trinitum.org
Cc:
AdminCc:

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



Subject: [PATCH] _parse_version performance improvement
Hello! Being regular cpanplus user I'm not quite happy with performance of its uptodate check. So I decided to investigate and found that one of the problems is Module::Load::Conditional::_parse_version. It matches $str argument against rather heavy regexp. By adding new check against simpler regex (/VERSION/) we could in 99% of cases (on my system, according to NYTProf) avoid matching against comlex regex and improve performance. Attached uptodate.pl script performs uptodate check. Results with original Module::Load::Conditional version 0.34: $ time perl uptodate.pl >/dev/null real 0m5.523s user 0m5.180s sys 0m0.300s With _parse_version_performance.patch applied: $ time perl uptodate.pl real 0m4.488s user 0m4.120s sys 0m0.340s -- Pavel Shaydo
Subject: _parse_version_performance.patch
--- lib/Module/Load/Conditional.pm 2009-10-29 12:22:35.000000000 +0300 +++ lib/Module/Load/Conditional.pm 2010-01-09 19:51:01.381856911 +0300 @@ -322,6 +322,9 @@ my $str = shift or return; my $verbose = shift or 0; + ### skip lines which doesn't contain VERSION + return unless $str =~ /VERSION/; + ### skip commented out lines, they won't eval to anything. return if $str =~ /^\s*#/;
Subject: uptodate.pl
#!/usr/bin/perl use strict; use warnings; use CPANPLUS; use CPANPLUS::Shell qw(Default); CPANPLUS::Shell->new->dispatch_on_input(input => 'o', noninteractive => 1);
Hi, Thanks for the patch. I have applied it and release version 0.36 to CPAN. Many thanks.