Changeset: 4a304d5c584e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4a304d5c584e
Modified Files:
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_hash.h
Branch: Dec2016
Log Message:

Move some testing out of the inner loop.


diffs (66 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1044,10 +1044,10 @@ BUNappend(BAT *b, const void *t, bit for
 
        IMPSdestroy(b); /* no support for inserts in imprints yet */
        OIDXdestroy(b);
-
-       /* first adapt the hashes; then the user-defined accelerators.
-        * REASON: some accelerator updates (qsignature) use the hashes!
-        */
+       if (b->thash == (Hash *) 1) {
+               /* don't bother first loading the hash to then change it */
+               HASHdestroy(b);
+       }
        if (b->thash) {
                HASHins(b, p, t);
                if (tsize && tsize != b->tvheap->size)
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -537,13 +537,16 @@ BATappend(BAT *b, BAT *n, bit force)
                        return GDK_FAIL;
                }
 
+               if (b->thash == (Hash *) 1) {
+                       /* don't bother first loading the hash to then
+                        * change it */
+                       HASHdestroy(b);
+               }
                BATloop(n, p, q) {
                        const void *t = BUNtail(ni, p);
 
                        bunfastapp(b, t);
-                       if (b->thash) {
-                               HASHins(b, i, t);
-                       }
+                       HASHins(b, i, t);
                        i++;
                }
                if (!b->tunique)
diff --git a/gdk/gdk_hash.h b/gdk/gdk_hash.h
--- a/gdk/gdk_hash.h
+++ b/gdk/gdk_hash.h
@@ -216,13 +216,14 @@ gdk_export BUN HASHlist(Hash *h, BUN i);
  * doing or want to keep the hash. */
 #define HASHins(b,i,v)                                                 \
        do {                                                            \
-               if ((b)->thash == (Hash *) 1 ||                         \
-                   (((i) & 1023) == 1023 && HASHgonebad((b), (v)))) {  \
-                       HASHdestroy(b);                                 \
-               } else {                                                \
-                       BUN _c = HASHprobe((b)->thash, (v));            \
-                       HASHputall((b)->thash, (i), _c);                \
-                       (b)->thash->heap->dirty = TRUE;                 \
+               if ((b)->thash) {                                       \
+                       if (((i) & 1023) == 1023 && HASHgonebad((b), (v))) { \
+                               HASHdestroy(b);                         \
+                       } else {                                        \
+                               BUN _c = HASHprobe((b)->thash, (v));    \
+                               HASHputall((b)->thash, (i), _c);        \
+                               (b)->thash->heap->dirty = TRUE;         \
+                       }                                               \
                }                                                       \
        } while (0)
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to