From: Martin Mares Date: Mon, 10 Sep 2007 18:55:23 +0000 (+0200) Subject: Redefined RadixThreshold to bound the array size instead of the number X-Git-Tag: holmes-import~506^2~13^2~22 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=1a3cd3005f2a5cda8dbdaaf8f153ae5703845876;p=libucw.git Redefined RadixThreshold to bound the array size instead of the number of elements -- the switching point seems to be related more to cache effects than decision performance. --- diff --git a/debug/sorter/radix-tune-bits.sh b/debug/sorter/radix-tune-bits.sh index 65098382..d0f02cc5 100644 --- a/debug/sorter/radix-tune-bits.sh +++ b/debug/sorter/radix-tune-bits.sh @@ -23,7 +23,7 @@ log "Decided to benchmark sorting of $SIZE byte data" WIDTHS="0 6 7 8 9 10 11 12 13 14" # Which RadixThresholds we try -THRS="100 500 1000 2500 5000" +THRS="2000 4000 10000 20000 50000" # Which sort-test tests we try TESTS="2,5,8,15" diff --git a/lib/sorter/array.c b/lib/sorter/array.c index efa314a8..5bc60276 100644 --- a/lib/sorter/array.c +++ b/lib/sorter/array.c @@ -48,7 +48,7 @@ asort_radix(struct asort_context *ctx, void *array, void *buffer, uns num_elts, for (uns i=0; ielt_size < sorter_radix_threshold || shift < ASORT_MIN_SHIFT) { ctx->quicksort(buffer, n); if (!swapped_output) @@ -216,7 +216,7 @@ rs_finish(struct worker_thread *thr UNUSED, struct work *ww) if (thr) DBG("Thread %d: Finishing %d items, shift=%d", thr->id, w->num_elts, w->shift); - if (w->shift < ASORT_MIN_SHIFT || w->num_elts < sorter_radix_threshold) + if (w->shift < ASORT_MIN_SHIFT || w->num_elts * ctx->elt_size < sorter_radix_threshold) { w->ctx->quicksort(w->in, w->num_elts); if (w->swap_output) @@ -396,7 +396,7 @@ asort_run(struct asort_context *ctx) ctx->num_elts * ctx->elt_size >= sorter_thread_threshold && !(sorter_debug & SORT_DEBUG_ASORT_NO_THREADS)); - if (ctx->num_elts < sorter_radix_threshold || + if (ctx->num_elts * ctx->elt_size < sorter_radix_threshold || ctx->hash_bits <= ASORT_MIN_SHIFT || !ctx->radix_split || (sorter_debug & SORT_DEBUG_ASORT_NO_RADIX))