Changeset: beede3ac7300 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/beede3ac7300
Modified Files:
        gdk/gdk_bat.c
Branch: Jul2021
Log Message:

When copying a var-sized bat where only vheap is a view, maybe don't copy.
If the copy is to be writable, we need to create a real copy, but it
may be faster to insert values individually than to copy the vheap
using memcpy (if the vheap is largely not referred to by the offset
heap).
Thanks


diffs (29 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -825,12 +825,19 @@ COLcopy(BAT *b, int tt, bool writable, r
                } else if (BATatoms[tt].atomFix) {
                        /* oops, we need to fix/unfix atoms */
                        slowcopy = true;
-               } else if (bi.h && bi.h->parentid != b->batCacheid) {
-                       /* extra checks needed for views */
-                       if (BATcapacity(BBP_cache(bi.h->parentid)) > bi.count + 
bi.count)
-                               /* reduced slice view: do not copy too
-                                * much garbage */
-                               slowcopy = true;
+               } else if (bi.h && bi.h->parentid != b->batCacheid &&
+                          BATcapacity(BBP_cache(bi.h->parentid)) > bi.count + 
bi.count) {
+                       /* reduced slice view: do not copy too much
+                        * garbage */
+                       slowcopy = true;
+               } else if (bi.vh && bi.vh->parentid != b->batCacheid &&
+                          BATcount(BBP_cache(bi.vh->parentid)) > bi.count + 
bi.count) {
+                       /* reduced vheap view: do not copy too much
+                        * garbage; this really is a heuristic since the
+                        * vheap could be used completely, even if the
+                        * offset heap is only (less than) half the size
+                        * of the parent's offset heap */
+                       slowcopy = true;
                }
 
                bn = COLnew_intern(b->hseqbase, tt, bi.count, role, bi.width);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to