thier3: added mlock/munlock for array and its temporary (you can turn this off)
This commit is contained in:
parent
ccdf991824
commit
d43b55f065
13
thiersort3.h
13
thiersort3.h
@ -3,6 +3,10 @@
|
||||
#include <stdint.h>
|
||||
/* A non-implace tricky float-hackz based bucket sort variant. Uses threepass_xbit and removes some compies! */
|
||||
|
||||
#ifndef NO_MLOCK
|
||||
#include <sys/mman.h> // mlock & munlock
|
||||
#endif // !NO_MLOCK
|
||||
|
||||
/* Disables extra 1-bit split processing before threepass_xb */
|
||||
#define NO_EXTRA_BIT /* I measure extra split to be slightly slower because overhead - despite less cache misses */
|
||||
|
||||
@ -66,6 +70,11 @@ static inline void thiersort3(uint32_t *arr, uint32_t *temparr, int n) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NO_MLOCK
|
||||
mlock(arr, n * sizeof(uint32_t));
|
||||
mlock(temparr, n * sizeof(uint32_t));
|
||||
#endif // !NO_MLOCK
|
||||
|
||||
/* Count */
|
||||
#pragma GCC unroll 64
|
||||
for(int i = 0; i < 256; ++i) {
|
||||
@ -179,6 +188,10 @@ static inline void thiersort3(uint32_t *arr, uint32_t *temparr, int n) {
|
||||
}
|
||||
}
|
||||
#endif /* NO_EXTRA_BIT */
|
||||
#ifndef NO_MLOCK
|
||||
munlock(arr, n * sizeof(uint32_t));
|
||||
munlock(temparr, n * sizeof(uint32_t));
|
||||
#endif // !NO_MLOCK
|
||||
}
|
||||
|
||||
#endif /* THIER_SORT3_H */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user