Changeset: 245c11f7cd6d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/245c11f7cd6d
Modified Files:
        gdk/gdk_private.h
        gdk/gdk_strimps.c
Branch: string_imprints
Log Message:

Add a reconstruction counter on strimps

It counts how many bitstrings have been added after the strimp header
was computed, and therefore have not been taken into account when
constructing it. The strimp will continue to give correct results but
its efficiency will decrease over time. We can use this counter to
decide when recreate the strimp from scratch.


diffs (36 lines):

diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -415,6 +415,9 @@ struct Strimps {
        uint8_t *sizes_base;    /* pointer into strimps heap (pair sizes)  */
        uint8_t *pairs_base;    /* pointer into strimps heap (pairs start)   */
        void *bitstrings_base;  /* pointer into strimps heap (bitstrings start) 
*/
+       size_t rec_cnt;         /* reconstruction counter: how many
+                                  bitstrings were added after header
+                                  construction */
        /* bitstrings_base is a pointer to uint64_t */
 };
 
diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -658,6 +658,7 @@ STRMPcreateStrimpHeap(BAT *b, BAT *s)
                }
                r->bitstrings_base = h2;
                r->strimps.free = sz;
+               r->rec_cnt = 0;
 
        }
        return r;
@@ -771,10 +772,7 @@ STRMPappendBitstring(BAT *b, const str s
        *dh = STRMPmakebitstring(s, strmp);
        strmp->strimps.free += sizeof(uint64_t);
 
-       // TODO increase reconstruction counter if
-       // reconstruction counter is larger than a threshold
-       // recompute the strimp from scratch.
-
+       strmp->rec_cnt++;
        MT_lock_unset(&pb->batIdxLock);
 
        TRC_DEBUG(ACCELERATOR, "appending to strimp took " LLFMT " usec\n", 
GDKusec()-t0);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to