trying some prefetch - not that good yet
This commit is contained in:
parent
0b4eb5e5a6
commit
3fdcaad537
@ -89,6 +89,9 @@ namespace MagyarSort {
|
||||
static inline void countOccurences(uint32_t arr[], COUNTER_TYP size, COUNTER_TYP *radicsOut) noexcept {
|
||||
#pragma GCC unroll 64
|
||||
for(COUNTER_TYP i = 0; i < size; ++i) {
|
||||
// Prefetch caches
|
||||
__builtin_prefetch(&arr[i]); // TODO: is good?
|
||||
__builtin_prefetch(&arr[i + 64]);
|
||||
// Creates no object, struct is empty
|
||||
OccurenceMagic<DIGITS - 1, COUNTER_TYP>(arr, i, radicsOut);
|
||||
}
|
||||
@ -139,6 +142,9 @@ namespace MagyarSort {
|
||||
|
||||
#pragma GCC unroll 64
|
||||
for(COUNTER_TYP i = size; i > 0; --i) { // right-to-left to ensure already sorted digits order we keep for iterations
|
||||
// Prefetch caches
|
||||
__builtin_prefetch(&from[i]); // TODO: is good?
|
||||
if(i >= 64) { __builtin_prefetch(&from[i - 64]); } // TODO: manually unroll?
|
||||
// Get num and its new offset / location
|
||||
auto num = from[i - 1];
|
||||
auto digVal = getDigit<DIGIT>(num);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user