projects
/
spider.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d80e548
)
really fix the caching in all cases
author
minima
<minima>
Sun, 29 Sep 2002 00:50:01 +0000
(
00:50
+0000)
committer
minima
<minima>
Sun, 29 Sep 2002 00:50:01 +0000
(
00:50
+0000)
perl/Prefix.pm
patch
|
blob
|
history
diff --git
a/perl/Prefix.pm
b/perl/Prefix.pm
index 3fdcdceaf8aa1823b43dedd01d3cbfb297fc28d0..0e67801d9e8f10ce494db023877ab5abcf67a439 100644
(file)
--- a/
perl/Prefix.pm
+++ b/
perl/Prefix.pm
@@
-148,10
+148,10
@@
sub matchprefix
my $pref = shift;
my @partials;
my $pref = shift;
my @partials;
- $pref =~ s/-\d+$//;
for (my $i = length $pref; $i; $i--) {
$matchtotal++;
my $s = substr($pref, 0, $i);
for (my $i = length $pref; $i; $i--) {
$matchtotal++;
my $s = substr($pref, 0, $i);
+ push @partials, $s;
my $p = $cache{$s};
if ($p) {
$hits++;
my $p = $cache{$s};
if ($p) {
$hits++;
@@
-159,10
+159,10
@@
sub matchprefix
my $percent = sprintf "%.1f", $hits * 100 / $misses;
dbg("Partial Prefix Cache Hit: $s Hits: $hits/$misses of $matchtotal = $percent\%");
}
my $percent = sprintf "%.1f", $hits * 100 / $misses;
dbg("Partial Prefix Cache Hit: $s Hits: $hits/$misses of $matchtotal = $percent\%");
}
+ $cache{$_} = $p for @partials;
return @$p;
} else {
$misses++;
return @$p;
} else {
$misses++;
- push @partials, $s;
my @out = get($s);
if (isdbg('prefix')) {
my $part = $out[0] || "*";
my @out = get($s);
if (isdbg('prefix')) {
my $part = $out[0] || "*";