Fix DXCC lookup#509
Conversation
|
Added the fix in |
dl1jbe
left a comment
There was a problem hiding this comment.
Looks good and makes a lot of sense.
Just to be curious: We did quite some performance test during implementation of the old behavior. Do we have some data how your PR affect that?
|
I'll check it. |
Please, do it only if you are interested yourself. It was just a question. |
|
Dug out the original PR #240: the speed test code is the
I made 50 runs of the test code per case. The std deviation of the data was below 0.01, so there is no significant difference due to the fix. In reality the fix removes ~40 false positives (mostly Italian prefixes) from the ~530 cache entries, but the related effect is minimal. The ~20% improvement due the 2-char cache is consistent with the results of #240. When at it, I also looked at adding some single letter prefixes (F,G,I,...) to the 2-char and it seems feasible. Will address this in a separate PR. |
DXCC lookup uses a cache for 2-character prefixes. It has an issue as all IT calls resolved as Sicily (IT9).
It is caused by too greedy caching: prefixes from more that 2-char calls shall not be cached, just used for marking the prefix as ambiguous.
Current implementation:
IT -> IT9
Should be:
IT -> ambiguous (as it could be a IT9 or any other ITx)
First added tests to reproduce the issue.