From fac01a81e35f4670aa6534aad9f1a7f4e5d692dd Mon Sep 17 00:00:00 2001 From: Richard Thier Date: Fri, 9 May 2025 02:36:04 +0200 Subject: [PATCH] schwab: tried to change cache friendlyness for branch prediction - it seems it is very marginally worse and much worse if I move thid after the other branches --- schwab_sort.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/schwab_sort.h b/schwab_sort.h index 36bd2d6..527effe 100644 --- a/schwab_sort.h +++ b/schwab_sort.h @@ -242,21 +242,17 @@ static inline void schwab_sort( /* But that would complicate codes above this point! */ /* Rem.: Order of operations try to be a cache-friendly as */ /* possible, but had to put loops changes to the end */ + if(needmid) { + schwab_sort(array, plo, pmid - 1, state); + schwab_sort(array, pmid, phi - 1, state); + } if(lolen < hilen) { schwab_sort(array, low, plo - 1, state); - if(needmid) { - schwab_sort(array, plo, pmid - 1, state); - schwab_sort(array, pmid, phi - 1, state); - } low = phi; /* high = high; */ } else { schwab_sort(array, phi, high, state); - if(needmid) { - schwab_sort(array, pmid, phi - 1, state); - schwab_sort(array, plo, pmid - 1, state); - } /* low = low; */ high = plo - 1;