in reply to Bitten by the worst case (or why it pays to know whats inside the black box)
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bitten by the worst case (or why it pays to know whats inside the black box)
by demerphq (Chancellor) on Jun 26, 2004 at 23:41 UTC | |
by mpeppler (Vicar) on Jun 27, 2004 at 15:36 UTC | |
by demerphq (Chancellor) on Jun 27, 2004 at 15:42 UTC |