Changeset: 25409d867a3c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=25409d867a3c
Modified Files:
monetdb5/mal/Tests/performanceTests/performanceLog
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/modules/mal/manifold.c
Branch: default
Log Message:
Control growth of MALblock
The initial size of a MAL block was 256 instructions and variables.
To further control its growth, the incremental steps is derived
from the old size plus a logarithmic growth.
diffs (100 lines):
diff --git a/monetdb5/mal/Tests/performanceTests/performanceLog
b/monetdb5/mal/Tests/performanceTests/performanceLog
--- a/monetdb5/mal/Tests/performanceTests/performanceLog
+++ b/monetdb5/mal/Tests/performanceTests/performanceLog
@@ -1305,3 +1305,18 @@ tst400e 1.241/1.086/0.137
tst901a 0.916/0.792/0.117
tst901b 1.968/1.823/0.122
+======================== 25 Feb 2017 ===================
+Vienna Fedora 25
+Default branch
+After fixing the timing.
+The compilation mode for is --enable-optimize --disable-debug
+command: time mserver5 TST </dev/null >/dev/null
+base 0.248/0.226/0.025
+tst400a 0.348/0.316/0.022
+tst400bHuge 0.245/0.208/0.025
+tst400cHuge 0.248/0.220/0.027
+tst400d 0.618/0.580/0.016
+tst400e 1.000/0.973/0.019
+
+tst901a 0.618/0.584/0.019
+tst901b 1.902/1.867/0.033
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -134,6 +134,18 @@ newMalBlk(int elements)
}
/* We only grow until the MAL block can be used */
+static int growBlk(int elm)
+{
+ int steps =1 ;
+ int old = elm;
+
+ while( old / 2 > 1){
+ old /= 2;
+ steps++;
+ }
+ return elm + steps * STMT_INCREMENT;
+}
+
int
resizeMalBlk(MalBlkPtr mb, int elements)
{
@@ -642,7 +654,7 @@ makeVarSpace(MalBlkPtr mb)
{
if (mb->vtop >= mb->vsize) {
VarRecord *new;
- int s = mb->vsize + STMT_INCREMENT;
+ int s = growBlk(mb->vsize);
new = (VarRecord*) GDKrealloc(mb->var, s * sizeof(VarRecord));
if (new == NULL) {
@@ -650,7 +662,7 @@ makeVarSpace(MalBlkPtr mb)
showException(GDKout, MAL, "newMalBlk",MAL_MALLOC_FAIL);
return -1;
}
- memset( ((char*) new) + mb->vsize * sizeof(VarRecord), 0,
STMT_INCREMENT * sizeof(VarRecord));
+ memset( ((char*) new) + mb->vsize * sizeof(VarRecord), 0, (s-
mb->vsize) * sizeof(VarRecord));
mb->vsize = s;
mb->var = new;
}
@@ -1368,9 +1380,9 @@ pushInstruction(MalBlkPtr mb, InstrPtr p
return;
if (mb->stop + 1 >= mb->ssize) {
- if( resizeMalBlk(mb,mb->ssize + STMT_INCREMENT)){
+ if( resizeMalBlk(mb, growBlk(mb->ssize)) ){
/* perhaps we can continue with a smaller increment.
- * But we block remains marked as faulty.
+ * But the block remains marked as faulty.
*/
if( resizeMalBlk(mb,mb->ssize + 1)){
/* we are now left with the situation that the
new instruction is dangling .
diff --git a/monetdb5/mal/mal_instruction.h b/monetdb5/mal/mal_instruction.h
--- a/monetdb5/mal/mal_instruction.h
+++ b/monetdb5/mal/mal_instruction.h
@@ -22,9 +22,8 @@
#define DEBUG_MAL_INSTR
/* #define DEBUG_REDUCE */
#define MAXARG 8 /* was 4 BEWARE the code
depends on this knowledge, where? */
-#define STMT_INCREMENT 256
+#define STMT_INCREMENT 4
#define MAL_VAR_WINDOW 32
-#define MAXVARS STMT_INCREMENT /* >= STMT_INCREMENT */
#define MAXLISTING 64*1024
/* Allocation of space assumes a rather exotic number of
diff --git a/monetdb5/modules/mal/manifold.c b/monetdb5/modules/mal/manifold.c
--- a/monetdb5/modules/mal/manifold.c
+++ b/monetdb5/modules/mal/manifold.c
@@ -198,7 +198,7 @@ MANIFOLDtypecheck(Client cntxt, MalBlkPt
if (pci->retc >1 || pci->argc > 8 || getModuleId(pci) == NULL) //
limitation on MANIFOLDjob
return NULL;
// We need a private MAL context to resolve the function call
- nmb = newMalBlk(MAXVARS);
+ nmb = newMalBlk(2 );
if( nmb == NULL)
return NULL;
// the scalar function
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list