Update of /cvsroot/monetdb/MonetDB/src/gdk
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13381/src/gdk

Modified Files:
        gdk_bat.mx gdk_setop.mx 
Log Message:
cleanup of BATgrows (removed leftover commented out code)
use BATgrows instead of fixed 64K increments to extend a bat in setop
(problem was found by marcin).


Index: gdk_setop.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_setop.mx,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- gdk_setop.mx        1 Feb 2008 12:21:37 -0000       1.62
+++ gdk_setop.mx        18 Mar 2008 21:20:24 -0000      1.63
@@ -527,13 +527,14 @@
                        p1 = 0;
                        q1 = BATcount(l);
                        while(p1 < q1) {
-                               BUN r1 = p1 + 65536;
-                               if (r1 > q1) r1 = q1;
-                               if (o + 65536 > BATcapacity(bn)){       
+                               BUN r1;
+                               if (p1 + 1 > BATcapacity(bn)){  
                                        BATsetcount(bn, o);
-                                       if (BATextend(bn, 
BATcapacity(bn)+65536) == NULL)
+                                       if (BATextend(bn, BATgrows(bn)) == NULL)
                                                goto bunins_failed; 
                                }
+                               r1 = p1 + BATcapacity(bn) - BUNlast(bn);
+                               if (r1 > q1) r1 = q1;
                                bnh = (@4*)Hloc(bn,0);
                                bnt = (oid*)Tloc(bn,0);
                                for (; p1<r1; p1++, b++){ 
@@ -556,16 +557,17 @@
                        p1 = BUNfirst(l);
                        q1 = BUNlast(l);
                        while(p1 < q1) {
-                               BUN r1 = p1 + 65536;
-                               if (r1 > q1) r1 = q1;
-                               if (BUNlast(bn) + 65536 > BATcapacity(bn)){     
+                               BUN r1;
+                               if (BUNlast(bn) + 1 > BATcapacity(bn)){ 
                                        if (BATextend(bn, 
BATcapacity(bn)+65536) == NULL)
                                                goto bunins_failed; 
                                }
+                               r1 = p1 + BATcapacity(bn) - BUNlast(bn);
+                               if (r1 > q1) r1 = q1;
                                for (; p1<r1; p1++) { 
                                        i = [EMAIL PROTECTED](H, h+p1);
                                        if (d[i] != 0 && @7(h+p1, rh+d[i]-1) &&
-                                       [EMAIL PROTECTED](BUNtail(li,p1), 
BUNtail(ri, d[i]-1))) {
+                                           [EMAIL PROTECTED](BUNtail(li,p1), 
BUNtail(ri, d[i]-1))) {
                                                [EMAIL PROTECTED](h+p1, 
BUNtail(li, p1));
                                        } else {
                                                [EMAIL PROTECTED](h+p1, 
BUNtail(li, p1));

Index: gdk_bat.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_bat.mx,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -d -r1.188 -r1.189
--- gdk_bat.mx  8 Feb 2008 22:35:05 -0000       1.188
+++ gdk_bat.mx  18 Mar 2008 21:20:22 -0000      1.189
@@ -343,14 +343,6 @@
                newcap = (size_t) ((double) newcap * BATMARGIN);
        if (newcap == oldcap)
                newcap += 10;
-
-       /* if we can extend in reserved space, do not miss the opportunity 
-       if (b->H->heap.size + Hsize(b) <= b->H->heap.maxsize) {
-               size_t rescap = oldcap + (b->H->heap.maxsize - b->H->heap.size) 
/ Hsize(b);
-
-               newcap = MIN(newcap, rescap);
-       }
-       */
        return newcap;
 }
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to