implemented first prefetch

based on dictID.
dictContent is prefetched up to 32 KB
(no contentSize adaptation)
This commit is contained in:
Yann Collet
2018-09-11 17:23:44 -07:00
parent 51a246da82
commit 63a519dbf6
3 changed files with 98 additions and 48 deletions
+8 -1
View File
@@ -97,12 +97,19 @@
# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */
# define PREFETCH(ptr) _mm_prefetch((const char*)ptr, _MM_HINT_T0)
# elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) )
# define PREFETCH(ptr) __builtin_prefetch(ptr, 0, 0)
# define PREFETCH(ptr) __builtin_prefetch(ptr, 0 /* rw==read */, 0 /* locality */)
# else
# define PREFETCH(ptr) /* disabled */
# endif
#endif /* NO_PREFETCH */
#define PREFETCH_AREA(ptr, size) { \
size_t pos; \
for (pos=0; pos<size; pos++) { \
PREFETCH( (const char*)(const void*)ptr + pos); \
} \
}
/* disable warnings */
#ifdef _MSC_VER /* Visual Studio */
# include <intrin.h> /* For Visual 2005 */