Update of /cvsroot/monetdb/sql/src/storage/bat
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2179/src/storage/bat

Modified Files:
        bat_storage.mx bat_table.mx bat_utils.mx 
Log Message:
more empty sharing (leak tests now use 1/3 less bats (ie from 300 to about 
200)).
use BBPquickdesk to speed startup 


Index: bat_table.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_table.mx,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- bat_table.mx        6 Nov 2007 15:22:13 -0000       1.30
+++ bat_table.mx        10 Nov 2007 21:47:29 -0000      1.31
@@ -87,15 +87,20 @@
                t = BATsemijoin(u,s); bat_destroy(u); u = t;
        }
        assert(b->ttype == i->ttype);
-       r = BATkunion(b,i); bat_destroy(b); bat_destroy(i); b = r;
-       r = BATkdiff(b,u); bat_destroy(b); b = r;
-       assert(b->ttype == u->ttype);
-       r = BATkunion(b,u); bat_destroy(b); bat_destroy(u); b = r;
-       if (d) {
+       if (BATcount(i)) {
+               r = BATkunion(b,i); bat_destroy(b); b = r;
+       }
+       bat_destroy(i); 
+       if (BATcount(u)) {
+               r = BATkdiff(b,u); bat_destroy(b); b = r;
+               assert(b->ttype == u->ttype);
+               r = BATkunion(b,u); bat_destroy(b); b = r;
+       }
+       bat_destroy(u); 
+       if (d && BATcount(d)) {
                r = BATkdiff(b,BATmirror(d)); bat_destroy(b); b = r;
        }
-       assert(r->T->hash == NULL);
-       return r;
+       return b;
 }
 
 static ssize_t

Index: bat_storage.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_storage.mx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- bat_storage.mx      6 Nov 2007 15:22:13 -0000       1.6
+++ bat_storage.mx      10 Nov 2007 21:47:29 -0000      1.7
@@ -78,6 +78,14 @@
 }
 
 static log_bid 
+e_bat(int type)
+{
+       if (!ebats[type]) 
+               ebats[type] = BATnew(TYPE_void, type, 0);
+       return temp_create(ebats[type]);
+}
+
+static log_bid 
 ebat_copy(log_bid b, oid ibase, int temp)
 {
        /* make a copy of b */
@@ -411,38 +419,31 @@
 }
 
 static sql_bat *
-load_bat( char *sname, char *tname, char *bname, int type, int sz, lng *cnt ) {
+load_bat( char *sname, char *tname, char *bname, int type, int sz, lng *cnt ) 
+{
        BAT *b;
        sql_bat *bat = ZNEW(sql_bat);
 
+       (void)sz;
        bat->name = sql_message("%s_%s_%s", sname, tname, bname );
-       b = temp_descriptor(logger_find_bat(bat_logger, bat->name));
+       b = quick_descriptor(logger_find_bat(bat_logger, bat->name));
        bat->bid = temp_create(b);
        *cnt = bat->ibase = BATcount(b);
-       bat_destroy(b);
        
        bat->uname = sql_message("U_%s", bat->name);
-       b = temp_descriptor(logger_find_bat(bat_logger, bat->uname));
+       b = quick_descriptor(logger_find_bat(bat_logger, bat->uname));
        bat->ubid = temp_create(b);
-       bat_destroy(b);
-
-       b = bat_new(TYPE_void, type, sz);
-       bat->ibid = temp_create(b);
-       BATseqbase(b, bat->ibase);
-       bat_destroy(b);
 
+       bat->ibid = e_bat(type);
        if (bat->bid && bat->ubid) {
-               BAT *b  = temp_descriptor(bat->bid);
-               BAT *ib  = temp_descriptor(bat->ibid);
                BAT *ub = temp_descriptor(bat->ubid);
 
-               BATseqbase(ib, bat->ibase);
-               *cnt = BATcount(b);
-               if (BATcount(ub)) 
+               if (BATcount(ub)) {
+                       BAT *b  = temp_descriptor(bat->bid);
                        update_table_bat(b, ub);
+                       bat_destroy(b);
+               }
                bat_destroy(ub);
-               bat_destroy(ib);
-               bat_destroy(b);
        }
        return bat;
 }
@@ -563,9 +564,8 @@
        if (t->base.flag == TR_OLD && !isTempTable(t)) {
                bat = t->data = ZNEW(sql_dbat);
                bat->dname = sql_message("D_%s_%s", t->s->base.name, 
t->base.name);
-               b = temp_descriptor(logger_find_bat(bat_logger, bat->dname));
+               b = quick_descriptor(logger_find_bat(bat_logger, bat->dname));
                bat->dbid = temp_create(b);
-               bat_destroy(b);
        } else if (bat && bat->dbid && !isTempTable(t)) {
                b = temp_descriptor(bat->dbid);
                bat->dbid = temp_create(b);

Index: bat_utils.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_utils.mx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- bat_utils.mx        6 Nov 2007 15:22:13 -0000       1.1
+++ bat_utils.mx        10 Nov 2007 21:47:29 -0000      1.2
@@ -24,6 +24,7 @@
 #include <gdk_logger.h>
 
 extern BAT *temp_descriptor(log_bid b);
+extern BAT *quick_descriptor(log_bid b);
 extern void temp_destroy(log_bid b);
 extern void temp_dup(log_bid b);
 extern log_bid temp_create(BAT *b);
@@ -105,6 +106,12 @@
        return BATdescriptor((bat) b);
 }
 
+BAT *
+quick_descriptor(log_bid b)
+{
+       return BBPquickdesc((bat) b, FALSE);
+}
+
 void
 temp_destroy(log_bid b)
 {


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to