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

EFM decoder performance improvements #801

Merged
merged 3 commits into from
Oct 2, 2022
Merged

Commits on Oct 2, 2022

  1. Configuration menu
    Copy the full SHA
    de41d0d View commit details
    Browse the repository at this point in the history
  2. Rewrite the frame-unpacking code in F3Frame::setTValues.

    This code converted T-values to a representation of the frame, then
    extracted EFM values from it. Both phases looped through every bit of
    the frame, which was very slow.
    
    Rewrite it to go directly from T-values to EFM values, with a single
    loop that executes once per T-value rather than once per bit. Profiling
    shows it now takes 5% of ld-process-efm's runtime rather than 50%.
    
    Comparing the output of the two versions also revealed that the original
    code would sometimes write the very last bit in the wrong place, usually
    hitting a merging bit but very occasionally corrupting the last EFM
    value in the frame (1-3 times an hour). So the new code produces very
    slightly better results.
    atsampson committed Oct 2, 2022
    Configuration menu
    Copy the full SHA
    f09021b View commit details
    Browse the repository at this point in the history
  3. Use a hash table to decode EFM symbols.

    The existing code did a linear search across a 256-entry array. Since
    this fits in L1 cache it wasn't as bad as it looked, but doing it with a
    hash table instead reduces the number of memory reads by a factor of
    100 (at most 2 reads per lookup).
    
    The hash function here was designed by an exhaustive search using a
    Python program.
    atsampson committed Oct 2, 2022
    Configuration menu
    Copy the full SHA
    13a7df7 View commit details
    Browse the repository at this point in the history