Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the EFM decoder logic #770

Merged
merged 2 commits into from
Aug 20, 2022
Merged

Conversation

atsampson
Copy link
Collaborator

Stop the linear search when an item is found, and store the correction table indexed by EFM value. This is about 5% faster on a good disc - it may have more impact on a disc that's doing lots of EFM corrections.

Breaking out of the linear search when you find a match speeds this up
by about 5% (mostly from the first loop, since that handles 99.999% of
the values on a good disc).
Since it contains an entry for every possible EFM code (with no
duplicates), it can be stored as a single array with the EFM code as the
index, avoiding the linear search.

(It's still quicker to use the linear search for the correct codes,
since the 512-byte lookup table fits in L1 cache; going straight to a
32+ KiB lookup table is much slower.)
@atsampson atsampson added enhancement ld-decode-tools An issue only affecting the ld-decode-tools labels Aug 12, 2022
@happycube happycube merged commit cc0ea56 into happycube:master Aug 20, 2022
@atsampson atsampson deleted the efmtweak branch August 20, 2022 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ld-decode-tools An issue only affecting the ld-decode-tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants