Changeset: c0289da61a92 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c0289da61a92
Modified Files:
        monetdb5/mal/mal_interpreter.mx
        monetdb5/optimizer/opt_mitosis.mx
Branch: default
Log Message:

Mitosis fixes
We should be less conservative in terms of result sizes.
Most arguments will be read sequentially and don't need all space.


diffs (92 lines):

diff --git a/monetdb5/mal/mal_interpreter.mx b/monetdb5/mal/mal_interpreter.mx
--- a/monetdb5/mal/mal_interpreter.mx
+++ b/monetdb5/mal/mal_interpreter.mx
@@ -672,27 +672,6 @@
        heapinfo(&b->T->heap); total += vol;
        heapinfo(b->T->vheap); total += vol;
        hashinfo(b->T->hash); total += vol;
-@= calcclaim
-t = total;
-if (stk->stk[getArg(pci,i)].vtype == TYPE_bat){
-       b = BATdescriptor(stk->stk[getArg(pci,i)].val.bval);
-       if (b==NULL)
-               continue;
-       @:calcFootprint@
-       /* prepare for hashes */
-       if ( b->H->hash == NULL && b->hsorted == 0  &&
-                b->T->hash == NULL && b->tsorted == 0 ){
-               if ( BATcount(b)  > cnt)
-                       cnt = BATcount(b);
-       }
-       if ( (b->ttype == TYPE_oid && !BATtordered(b) && !BATtdense(b)) ||
-          ( b->htype == TYPE_oid && !BAThordered(b) && !BAThdense(b)) ){
-               /* assume we may have to do random IO, punish it by increasing 
the claim  with hash elem size*/
-               total += 4 * cnt;
-               total = total >(lng) (MEMORY_THRESHOLD * monet_memory)? (lng) 
(MEMORY_THRESHOLD * monet_memory):total;
-       }
-       BBPunfix( h = b->batCacheid);
-}
 @c
 /*
  * The memory claim is the estimate for the amount of memory hold.
@@ -702,7 +681,6 @@
 getMemoryClaim(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int i, int flag){
        lng total=0, vol = 0;
        BAT *b;
-       BUN cnt = 0;
 
        (void) mb;
        if (stk->stk[getArg(pci,i)].vtype == TYPE_bat){
@@ -714,18 +692,7 @@
                        return 0;
                }
                @:calcFootprint@
-               /* prepare for hashes */
-               if ( b->H->hash == NULL && b->hsorted == 0  &&
-                        b->T->hash == NULL && b->tsorted == 0 ){
-                       if ( BATcount(b)  > cnt)
-                               cnt = BATcount(b);
-               }
-               if ( (b->ttype == TYPE_oid && !BATtordered(b) && !BATtdense(b)) 
||
-                  ( b->htype == TYPE_oid && !BAThordered(b) && !BAThdense(b)) 
){
-                       /* assume we may have to do random IO, punish it by 
increasing the claim  with hash elem size*/
-                       total += 4 * cnt;
-                       total = total >(lng) (MEMORY_THRESHOLD * monet_memory)? 
(lng) (MEMORY_THRESHOLD * monet_memory):total;
-               }
+               total = total >(lng) (MEMORY_THRESHOLD * monet_memory)? (lng) 
(MEMORY_THRESHOLD * monet_memory):total;
                BBPunfix( b->batCacheid);
        }
        return total;
@@ -744,7 +711,6 @@
        /* optimistically set memory */
        if ( argclaim == 0)
                return 0;
-       return 0;
 
        mal_set_lock(mal_contextLock, "DFLOWdelay");
        if (memorypool <= 0 && memoryclaims == 0) {
diff --git a/monetdb5/optimizer/opt_mitosis.mx 
b/monetdb5/optimizer/opt_mitosis.mx
--- a/monetdb5/optimizer/opt_mitosis.mx
+++ b/monetdb5/optimizer/opt_mitosis.mx
@@ -98,7 +98,7 @@
        oid slice;
        wrd r = 0, rowcnt=0;    /* table should be sizeable to consider 
parallel execution*/
        InstrPtr q,*old, target= 0, matq;
-       size_t typewidth= 3 *sizeof(lng); /* 2 arguments and a result */
+       size_t typewidth= sizeof(lng) + sizeof(oid); /* a common result size */
        int threads = GDKnr_threads ? GDKnr_threads:1;
        ValRecord vr;
        VarPtr loc,rows;
@@ -152,10 +152,10 @@
        if ( (i = OPTtarantulaAdviceInternal(mb,stk,p)) > 0 )
                pieces = i;
        else {
-               /* ensure that GDKnr_threads partitions fit into main memory */
+               /* ensure that GDKnr_threads result partition fit into main 
memory */
                r = (BUN) (monet_memory / typewidth / threads);
                if (rowcnt > r)
-                       pieces = (int) MAX ( (rowcnt / r + 1) , (wrd) threads );
+                       pieces = (int) MAX ( ((rowcnt / r )? rowcnt/r:1) , 
(wrd) threads );
                else
                /* exploit parallelism, but ensure minimal partition size to 
limit overhead */
                if (rowcnt > MINPARTCNT)
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to