Nice meditation!
After a bit of review I realized that the problem was due to the way I was implementing the cache lookup. The process was essentially this: produce the union of four queries each of which returned a variable number of two field records, (the first number being a telephone prefix, and the second being an ID that represented its pricing model) then join that data together to form a string key that could be used in a hash lookup to determine if the data was already in the cache.
Some other ideas:
Not sure if there's a win there or not, but it's interesting anyway :)use List::Util qw(shuffle); my $alphabet = join '', shuffle 'a'..'z'; # do this only once and sav +e it to a file for later reading my $t; @union = map { $_->[1] } sort { $a->[0] cmp $b->[0] } map { eval "(\$t = lc \$_) =~ tr/$alphabet/a-z/"; [ $t, $_ ] +} @union;
In reply to Re: Bitten by the worst case (or why it pays to know whats inside the black box)
by duff
in thread Bitten by the worst case (or why it pays to know whats inside the black box)
by demerphq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |