Skip to content

Fix DXCC lookup#509

Open
zcsahok wants to merge 2 commits into
Tlf:masterfrom
zcsahok:fix_2char_dxcc_lookup
Open

Fix DXCC lookup#509
zcsahok wants to merge 2 commits into
Tlf:masterfrom
zcsahok:fix_2char_dxcc_lookup

Conversation

@zcsahok

@zcsahok zcsahok commented Jun 16, 2026

Copy link
Copy Markdown
Member

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.

@zcsahok

zcsahok commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

Added the fix in prefix_add()

@dl1jbe dl1jbe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@zcsahok

zcsahok commented Jun 21, 2026

Copy link
Copy Markdown
Member Author

I'll check it.

@dl1jbe

dl1jbe commented Jun 21, 2026

Copy link
Copy Markdown
Member

I'll check it.

Please, do it only if you are interested yourself. It was just a question.

@zcsahok

zcsahok commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

Dug out the original PR #240: the speed test code is the test_xspeed() in test/test_getctydata.c, just TEST_LOOKUP_SPEED has to be defined. It makes 20M random lookups based from the callmaster file.
Testing on a 20 yr laptop (Intel Pentium M processor 1.70GHz) used regularly for portable logging gave these figures (usec/lookup):

  • 2-char cache disabled: 0.70
  • with 2-char cache, as before this PR: 0.54
  • 2-char cache fixed as per this PR: 0.54

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants