Merge pull request #2134 from terrelln/align-lazy

[greedy] Fix performance instability
This commit is contained in:
Yann Collet 2020-05-12 20:49:10 -07:00 committed by GitHub
commit ad34d58218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;