Changeset: 058956f762e5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/058956f762e5
Modified Files:
gdk/gdk_batop.c
gdk/gdk_project.c
Branch: default
Log Message:
Special code for appending string bats with only nils.
diffs (66 lines):
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -160,11 +160,25 @@ insert_string_bat(BAT *b, BATiter *ni, s
toff = 0;
b->tvkey |= ni->vkey;
MT_thread_setalgorithm("shared vheap", __func__);
+ } else if (ni->vhfree <= GDK_STRHASHSIZE &&
+ (!GDK_ELIMDOUBLES(b->tvheap) ||
+ strLocate(b->tvheap, str_nil) == 0)) {
+ /* the incoming bat's vheap is empty, meaning the bat
+ * contains only nil values, if the destination bat's
+ * nil is also at offset 0, we can just copy zeros */
+ toff = 0;
+ MT_thread_setalgorithm("empty source vheap (just nils)",
+ __func__);
} else if (b->ustr) {
MT_thread_setalgorithm("individual inserts into ustr",
__func__);
- } else if (mayshare && b->batRole == TRANSIENT && oldcnt == 0) {
+ } else if (mayshare && b->batRole == TRANSIENT &&
+ (oldcnt == 0 || (b->tvheap->free <= GDK_STRHASHSIZE &&
+ (!GDK_ELIMDOUBLES(ni->vh) ||
+ strLocate(ni->vh, str_nil) == 0)))) {
/* we can share the vheaps, so we then only need to
- * append the offsets */
+ * append the offsets; the condition is: b is empty, or
+ * its vheap is empty (i.e. there are only nils) and the
+ * incoming heap also stores them with offset 0 */
MT_lock_set(&b->theaplock);
bat bid = b->tvheap->parentid;
HEAPdecref(b->tvheap, bid == b->batCacheid);
diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c
--- a/gdk/gdk_project.c
+++ b/gdk/gdk_project.c
@@ -396,6 +396,7 @@ BATproject2(BAT *restrict l, BAT *restri
lo = l->tseqbase;
hi = l->tseqbase + lcount;
if (lo >= r1->hseqbase && hi <= r1->hseqbase + r1i.count) {
+ MT_thread_setalgorithm("using slice", __func__);
bn = BATslice(r1, lo - r1->hseqbase, hi - r1->hseqbase);
BAThseqbase(bn, l->hseqbase);
msg = " (slice)";
@@ -409,6 +410,7 @@ BATproject2(BAT *restrict l, BAT *restri
return NULL;
}
if (lo >= r2->hseqbase) {
+ MT_thread_setalgorithm("using slice", __func__);
bn = BATslice(r2, lo - r2->hseqbase, hi - r2->hseqbase);
BAThseqbase(bn, l->hseqbase);
msg = " (slice2)";
@@ -439,6 +441,7 @@ BATproject2(BAT *restrict l, BAT *restri
/* trivial: all values are nil (includes no entries at all) */
const void *nil = r1i.type == TYPE_msk ? &oid_nil :
ATOMnilptr(r1i.type);
+ MT_thread_setalgorithm("constant result", __func__);
bn = BATconstant(l->hseqbase, r1i.type == TYPE_oid || r1i.type
== TYPE_msk ? TYPE_void : r1i.type,
nil, lcount, TRANSIENT);
if (bn != NULL &&
@@ -459,6 +462,7 @@ BATproject2(BAT *restrict l, BAT *restri
* heaps */
tpe = r1i.width == 1 ? TYPE_bte : (r1i.width == 2 ?
TYPE_sht : (r1i.width == 4 ? TYPE_int : TYPE_lng));
vheaptrick = true;
+ MT_thread_setalgorithm("using vheaptrick", __func__);
}
} else if (tpe == TYPE_msk || mask_cand(r1)) {
r1 = BATunmask(r1);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]