diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-11-07 09:52:05 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-11-07 09:52:05 +0000 |
commit | 8d4e74b110be9be6e6963ea33d35b9b8c5b97dd6 (patch) | |
tree | c3f633b92620a556d8a51c9463420beaa9364008 /urpmf | |
parent | ff8b5878a7defaf27322655fb24dfc49e32fdfbb (diff) | |
download | urpmi-8d4e74b110be9be6e6963ea33d35b9b8c5b97dd6.tar urpmi-8d4e74b110be9be6e6963ea33d35b9b8c5b97dd6.tar.gz urpmi-8d4e74b110be9be6e6963ea33d35b9b8c5b97dd6.tar.bz2 urpmi-8d4e74b110be9be6e6963ea33d35b9b8c5b97dd6.tar.xz urpmi-8d4e74b110be9be6e6963ea33d35b9b8c5b97dd6.zip |
pre-compute part of the qf in case of multitag
=> around 25% speedup for file search and 10% speedup for requires search
Diffstat (limited to 'urpmf')
-rwxr-xr-x | urpmf | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -132,12 +132,18 @@ my $sprintfargs = join(', ', map { } elsif ($multitags{$_}) { $multitag and $urpm->{fatal}->(1, N("Incorrect format: you may use only one multi-valued tag")); $multitag = $_; - '$mt'; + "'%s'"; } else { '$pkg->' . $_; } } $qf =~ /%[-\d]*(\w+)/g); +my ($proto_cooked, $sprintfargs_cooked); +if ($multitag) { + ($proto_cooked, $sprintfargs_cooked) = ($proto, $sprintfargs); + ($proto, $sprintfargs) = ('$proto_cooked', '$mt'); +} + my $next_st = $multitag ? 'next' : 'return 1'; my @inner = ( "my \$s = sprintf(qq{$proto}, $sprintfargs);", @@ -148,6 +154,7 @@ my @inner = ( if ($multitag) { @inner = ( + "my \$proto_cooked = sprintf(qq{$proto_cooked}, $sprintfargs_cooked);", "foreach my \$mt (\$pkg->$multitag) {", (map { " $_" } @inner), "}", |