Changeset: dfe59deeb93a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dfe59deeb93a
Modified Files:
gdk/gdk_batop.c
gdk/gdk_heap.c
Branch: Jan2022
Log Message:
Grow vheap a little faster, copy vheaps when we can in BATappend.
diffs (61 lines):
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -373,8 +373,6 @@ append_varsized_bat(BAT *b, BAT *n, stru
/* if b is still empty, in the transient farm, and n
* is read-only, we replace b's vheap with a reference
* to n's */
- /* make sure locking happens in a predictable order:
- * lowest id first */
MT_lock_set(&b->theaplock);
if (b->tvheap->parentid != b->batCacheid)
BBPunshare(b->tvheap->parentid);
@@ -441,6 +439,33 @@ append_varsized_bat(BAT *b, BAT *n, stru
b->tvheap = h;
MT_lock_unset(&b->theaplock);
}
+ if (BATcount(b) == 0 && BATatoms[b->ttype].atomFix == NULL &&
+ ci->tpe == cand_dense && ci->ncand == ni.count) {
+ /* just copy the heaps */
+ if (HEAPgrow(&b->theaplock, &b->tvheap, ni.vhfree, false) !=
GDK_SUCCEED) {
+ bat_iterator_end(&ni);
+ return GDK_FAIL;
+ }
+ memcpy(b->theap->base, ni.base, ni.hfree);
+ memcpy(b->tvheap->base, ni.vh->base, ni.vhfree);
+ b->theap->free = ni.hfree;
+ b->tvheap->free = ni.vhfree;
+ BATsetcount(b, ni.count);
+ b->tnil = n->tnil;
+ b->tnonil = n->tnonil;
+ b->tsorted = n->tsorted;
+ b->tnosorted = n->tnosorted;
+ b->trevsorted = n->trevsorted;
+ b->tnorevsorted = n->tnorevsorted;
+ b->tkey = n->tkey;
+ b->tnokey[0] = n->tnokey[0];
+ b->tnokey[1] = n->tnokey[1];
+ b->tminpos = n->tminpos;
+ b->tmaxpos = n->tmaxpos;
+ b->tunique_est = n->tunique_est;
+ bat_iterator_end(&ni);
+ return GDK_SUCCEED;
+ }
/* copy data from n to b */
r = BUNlast(b);
MT_rwlock_wrlock(&b->thashlock);
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -1097,7 +1097,11 @@ HEAP_malloc(BAT *b, size_t nbytes)
size_t newsize;
assert(heap->free + MAX(heap->free, nbytes) <= VAR_MAX);
+#if SIZEOF_SIZE_T == 4
newsize = MIN(heap->free, (size_t) 1 << 20);
+#else
+ newsize = MIN(heap->free, (size_t) 1 << 30);
+#endif
newsize = (size_t) roundup_8(heap->free + MAX(newsize, nbytes));
assert(heap->free <= VAR_MAX);
block = (size_t) heap->free; /* current end-of-heap */
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]