[greedy] Fix performance instability

dev
Nick Terrell 2020-05-12 17:51:16 -07:00
parent c3e921c639
commit 70c80e19e6
1 changed files with 12 additions and 0 deletions

View File

@ -681,6 +681,12 @@ ZSTD_compressBlock_lazy_generic(
}
/* Match Loop */
#if defined(__GNUC__) && defined(__x86_64__)
/* I've measured random a 5% speed loss on levels 5 & 6 (greedy) when the
* code alignment is perturbed. To fix the instability align the loop on 32-bytes.
*/
__asm__(".p2align 5");
#endif
while (ip < ilimit) {
size_t matchLength=0;
size_t offset=0;
@ -952,6 +958,12 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(
ip += (ip == prefixStart);
/* Match Loop */
#if defined(__GNUC__) && defined(__x86_64__)
/* I've measured random a 5% speed loss on levels 5 & 6 (greedy) when the
* code alignment is perturbed. To fix the instability align the loop on 32-bytes.
*/
__asm__(".p2align 5");
#endif
while (ip < ilimit) {
size_t matchLength=0;
size_t offset=0;