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

Refactor prefetching for the decoding loop #2547

Merged
merged 7 commits into from
May 7, 2021
Merged

Commits on Mar 19, 2021

  1. Refactor prefetching for the decoding loop

    Following #2545,
    I noticed that one field in `seq_t` is optional,
    and only used in combination with prefetching.
    (This may have contributed to static analyzer failure to detect correct initialization).
    
    I then wondered if it would be possible to rewrite the code
    so that this optional part is handled directly by the prefetching code
    rather than delegated as an option into `ZSTD_decodeSequence()`.
    
    This resulted into this refactoring exercise
    where the prefetching responsibility is better isolated into its own function
    and `ZSTD_decodeSequence()` is streamlined to contain strictly Sequence decoding operations.
    Incidently, due to better code locality,
    it reduces the need to send information around,
    leading to simplified interface, and smaller state structures.
    Cyan4973 committed Mar 19, 2021
    Configuration menu
    Copy the full SHA
    f543466 View commit details
    Browse the repository at this point in the history

Commits on May 5, 2021

  1. Configuration menu
    Copy the full SHA
    8cde167 View commit details
    Browse the repository at this point in the history

Commits on May 7, 2021

  1. Configuration menu
    Copy the full SHA
    ee425fa View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a4d55c8 View commit details
    Browse the repository at this point in the history
  3. improve decompression speed of long variant by ~+5%

    changed strategy,
    now unconditionally prefetch the first 2 cache lines,
    instead of cache lines corresponding to the first and last bytes of the match.
    
    This better corresponds to cpu expectation,
    which should auto-prefetch following cachelines on detecting the sequential nature of the read.
    
    This is globally positive, by +5%,
    though exact gains depend on compiler (from -2% to +15%).
    The only negative counter-example is gcc-9.
    Cyan4973 committed May 7, 2021
    Configuration menu
    Copy the full SHA
    1db5947 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4d9caa4 View commit details
    Browse the repository at this point in the history
  5. update decoder hot loop alignment

    This seems to bring an additional ~+1.2% decompression speed
    on average across 10 compilers x 6 scenarios.
    Cyan4973 committed May 7, 2021
    Configuration menu
    Copy the full SHA
    6755baf View commit details
    Browse the repository at this point in the history