]> mj.ucw.cz Git - libucw.git/blobdiff - lib/sorter/govern.c
Made radix-sorting threshold configurable and let radix-tune-bits
[libucw.git] / lib / sorter / govern.c
index 2626d62b9a73689fb866d92da2257d7e4b9f8ae1..826417d1f6e3207c91eda5cc2a53efbb76390190 100644 (file)
@@ -48,9 +48,14 @@ sorter_presort(struct sort_context *ctx, struct sort_bucket *in, struct sort_buc
   sorter_alloc_buf(ctx);
   if (in->flags & SBF_CUSTOM_PRESORT)
     {
   sorter_alloc_buf(ctx);
   if (in->flags & SBF_CUSTOM_PRESORT)
     {
+      /*
+       *  The trick with automatic joining, which we use for the normal presorter,
+       *  is not necessary with the custom presorter, because the custom presorter
+       *  is never called in the middle of the sorted data.
+       */
       struct fastbuf *f = sbuck_write(out);
       out->runs++;
       struct fastbuf *f = sbuck_write(out);
       out->runs++;
-      return ctx->custom_presort(f, ctx->big_buf, ctx->big_buf_size);  // FIXME: out_only optimization?
+      return ctx->custom_presort(f, ctx->big_buf, ctx->big_buf_size);
     }
   return ctx->internal_sort(ctx, in, out, out_only);
 }
     }
   return ctx->internal_sort(ctx, in, out, out_only);
 }
@@ -325,7 +330,7 @@ sorter_decide(struct sort_context *ctx, struct sort_bucket *b)
   // How many bits of bucket size we have to reduce before it fits in the RAM?
   // (this is insanely large if the input size is unknown, but it serves our purpose)
   u64 insize = sbuck_size(b);
   // How many bits of bucket size we have to reduce before it fits in the RAM?
   // (this is insanely large if the input size is unknown, but it serves our purpose)
   u64 insize = sbuck_size(b);
-  u64 mem = ctx->internal_estimate(ctx, b) * 0.8;      // FIXME: Magical factor for various non-uniformities
+  u64 mem = ctx->internal_estimate(ctx, b) * 0.8;      // Magical factor accounting for various non-uniformities
   uns bits = 0;
   while ((insize >> bits) > mem)
     bits++;
   uns bits = 0;
   while ((insize >> bits) > mem)
     bits++;