Changeset: 2cdc69339d72 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2cdc69339d72
Modified Files:
gdk/gdk_group.c
gdk/gdk_join.c
gdk/gdk_system_private.h
gdk/gdk_unique.c
Branch: Jul2015
Log Message:
Refinement of changeset 803f067c823e.
diffs (149 lines):
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -379,7 +379,9 @@ BATgroup_internal(BAT **groups, BAT **ex
Hash *hs = NULL;
BUN hb;
BUN maxgrps;
+#ifndef DISABLE_PARENT_HASH
bat parent;
+#endif
if (b == NULL || !BAThdense(b)) {
GDKerror("BATgroup: b must be dense-headed\n");
@@ -781,6 +783,7 @@ BATgroup_internal(BAT **groups, BAT **ex
e ? BATgetId(e) : "NULL", e ? BATcount(e) : 0,
h ? BATgetId(h) : "NULL", h ? BATcount(h) : 0,
subsorted);
+#ifndef DISABLE_PARENT_HASH
if (b->T->hash == NULL && (parent = VIEWtparent(b)) != 0) {
/* b is a view on another bat (b2 for now).
* calculate the bounds [lo, hi) in the parent
@@ -791,7 +794,9 @@ BATgroup_internal(BAT **groups, BAT **ex
hseqb = b->hseqbase;
b = b2;
bi = bat_iterator(b);
- } else {
+ } else
+#endif
+ {
lo = BUNfirst(b);
hi = BUNlast(b);
}
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -2927,7 +2927,9 @@ BATsubjoin(BAT **r1p, BAT **r2p, BAT *l,
BUN lsize, rsize;
BUN maxsize;
int lhash, rhash;
+#ifndef DISABLE_PARENT_HASH
bat lparent, rparent;
+#endif
int swap;
size_t mem_size;
@@ -2968,9 +2970,8 @@ BATsubjoin(BAT **r1p, BAT **r2p, BAT *l,
rsize = (BUN) (BATcount(r) * (Tsize(r)) + (r->T->vheap ?
r->T->vheap->size : 0) + 2 * sizeof(BUN));
mem_size = GDK_mem_maxsize / (GDKnr_threads ? GDKnr_threads : 1);
+#ifndef DISABLE_PARENT_HASH
lparent = VIEWtparent(l);
- rparent = VIEWtparent(r);
-#ifndef DISABLE_PARENT_HASH
if (lparent) {
lpcount = BATcount(BBPdescriptor(lparent));
lhash = BATcheckhash(l) ||
BATcheckhash(BBPdescriptor(-lparent));
@@ -2981,6 +2982,7 @@ BATsubjoin(BAT **r1p, BAT **r2p, BAT *l,
lhash = BATcheckhash(l);
}
#ifndef DISABLE_PARENT_HASH
+ rparent = VIEWtparent(r);
if (rparent) {
rpcount = BATcount(BBPdescriptor(rparent));
rhash = BATcheckhash(r) ||
BATcheckhash(BBPdescriptor(-rparent));
@@ -3025,21 +3027,33 @@ BATsubjoin(BAT **r1p, BAT **r2p, BAT *l,
* large (i.e. prefer hash over binary search, but
* only if the hash table doesn't cause thrashing) */
return mergejoin(r1, r2, l, r, sl, sr, nil_matches, 0, 0, 0,
maxsize);
- } else if ((l->batPersistence == PERSISTENT ||
- (lparent != 0 &&
- BBPquickdesc(abs(lparent), 0)->batPersistence ==
PERSISTENT)) &&
- !(r->batPersistence == PERSISTENT ||
- (rparent != 0 &&
- BBPquickdesc(abs(rparent), 0)->batPersistence ==
PERSISTENT))) {
+ } else if ((l->batPersistence == PERSISTENT
+#ifndef DISABLE_PARENT_HASH
+ || (lparent != 0 &&
+ BBPquickdesc(abs(lparent), 0)->batPersistence ==
PERSISTENT)
+#endif
+ ) &&
+ !(r->batPersistence == PERSISTENT
+#ifndef DISABLE_PARENT_HASH
+ || (rparent != 0 &&
+ BBPquickdesc(abs(rparent), 0)->batPersistence ==
PERSISTENT)
+#endif
+ )) {
/* l (or its parent) is persistent and r is not,
* create hash on l since it may be reused */
swap = 1;
- } else if (!(l->batPersistence == PERSISTENT ||
- (lparent != 0 &&
- BBPquickdesc(abs(lparent), 0)->batPersistence ==
PERSISTENT)) &&
- (r->batPersistence == PERSISTENT ||
- (rparent != 0 &&
- BBPquickdesc(abs(rparent), 0)->batPersistence ==
PERSISTENT))) {
+ } else if (!(l->batPersistence == PERSISTENT
+#ifndef DISABLE_PARENT_HASH
+ || (lparent != 0 &&
+ BBPquickdesc(abs(lparent), 0)->batPersistence ==
PERSISTENT)
+#endif
+ ) &&
+ (r->batPersistence == PERSISTENT
+#ifndef DISABLE_PARENT_HASH
+ || (rparent != 0 &&
+ BBPquickdesc(abs(rparent), 0)->batPersistence ==
PERSISTENT)
+#endif
+ )) {
/* l (and its parent) is not persistent but r (or its
* parent) is, create hash on r since it may be
* reused */
diff --git a/gdk/gdk_system_private.h b/gdk/gdk_system_private.h
--- a/gdk/gdk_system_private.h
+++ b/gdk/gdk_system_private.h
@@ -19,5 +19,3 @@
__attribute__((__visibility__("hidden")));
__hidden int MT_kill_thread(MT_Id t)
__attribute__((__visibility__("hidden")));
-
-/* #define DISABLE_PARENT_HASH 1 */
diff --git a/gdk/gdk_unique.c b/gdk/gdk_unique.c
--- a/gdk/gdk_unique.c
+++ b/gdk/gdk_unique.c
@@ -41,7 +41,9 @@ BATsubunique(BAT *b, BAT *s)
BUN hb;
BATiter bi;
int (*cmp)(const void *, const void *);
+#ifndef DISABLE_PARENT_HASH
bat parent;
+#endif
BATcheck(b, "BATsubunique", NULL);
if (b->tkey || BATcount(b) <= 1 || BATtdense(b)) {
@@ -260,12 +262,15 @@ BATsubunique(BAT *b, BAT *s)
s ? BATgetId(s) : "NULL",
s ? BATcount(s) : 0);
seq = b->hseqbase;
+#ifndef DISABLE_PARENT_HASH
if (b->T->hash == NULL && (parent = VIEWtparent(b)) != 0) {
BAT *b2 = BBPdescriptor(-parent);
lo = (BUN) ((b->T->heap.base - b2->T->heap.base) >>
b->T->shift) + BUNfirst(b);
b = b2;
bi = bat_iterator(b);
- } else {
+ } else
+#endif
+ {
lo = BUNfirst(b);
}
hs = b->T->hash;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list