Changeset: bdc4a8b27df7 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bdc4a8b27df7
Modified Files:
monetdb5/mal/mal_instruction.c
Branch: default
Log Message:
Reduce mallocs upon system start
There are about 11K symbols.
diffs (38 lines):
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
@@ -16,6 +16,10 @@
#include "mal_utils.h"
#include "mal_exception.h"
+#define MAXSYMBOLS 12000 /* enough for the startup and some queries */
+static SymRecord symbolpool[MAXSYMBOLS];
+static int symboltop;
+
Symbol
newSymbol(str nme, int kind)
{
@@ -25,7 +29,12 @@ newSymbol(str nme, int kind)
GDKerror("newSymbol:unexpected name (=null)\n");
return NULL;
}
- cur = (Symbol) GDKzalloc(sizeof(SymRecord));
+ if( symboltop < MAXSYMBOLS){
+ cur = symbolpool + symboltop;
+ symboltop++;
+ } else
+ cur = (Symbol) GDKzalloc(sizeof(SymRecord));
+
if (cur == NULL) {
GDKerror("newSymbol:" MAL_MALLOC_FAIL);
return NULL;
@@ -50,7 +59,8 @@ freeSymbol(Symbol s)
freeMalBlk(s->def);
s->def = NULL;
}
- GDKfree(s);
+ if( !( s >= symbolpool && s < symbolpool + MAXSYMBOLS))
+ GDKfree(s);
}
void
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list