Changeset: d493f5ec0c7d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d493f5ec0c7d
Modified Files:
        monetdb5/modules/mosaic/TODO_MOSAIC.txt
        monetdb5/modules/mosaic/mosaic.h
        monetdb5/modules/mosaic/mosaic_delta.c
        monetdb5/modules/mosaic/mosaic_delta.h
        monetdb5/modules/mosaic/mosaic_dictionary.h
        monetdb5/modules/mosaic/mosaic_frame.c
        monetdb5/modules/mosaic/mosaic_frame.h
        monetdb5/modules/mosaic/mosaic_linear.h
        monetdb5/modules/mosaic/mosaic_prefix.c
        monetdb5/modules/mosaic/mosaic_prefix.h
        monetdb5/modules/mosaic/mosaic_raw.h
        monetdb5/modules/mosaic/mosaic_runlength.h
Branch: mosaic
Log Message:

Compress the blockheader somewhat.


diffs (236 lines):

diff --git a/monetdb5/modules/mosaic/TODO_MOSAIC.txt 
b/monetdb5/modules/mosaic/TODO_MOSAIC.txt
--- a/monetdb5/modules/mosaic/TODO_MOSAIC.txt
+++ b/monetdb5/modules/mosaic/TODO_MOSAIC.txt
@@ -1,7 +1,6 @@
 ####technical depth####
 Add raw to technique overview in analysis
 Rename 'capped' and 'var' to 'dict256' and 'dict' respectively.
-Make header smaller: add padding to outer struct
 Fix/check/test MOSlayout.
 Add negative values to tests
 Add test for huge
diff --git a/monetdb5/modules/mosaic/mosaic.h b/monetdb5/modules/mosaic/mosaic.h
--- a/monetdb5/modules/mosaic/mosaic.h
+++ b/monetdb5/modules/mosaic/mosaic.h
@@ -115,10 +115,9 @@ typedef struct MOSAICBLK {
        unsigned int tag:((sizeof(unsigned int) * CHAR_BIT) - CNT_BITS), 
cnt:CNT_BITS;
 } MosaicBlkRec, *MosaicBlk;
 
-typedef struct {
-       MosaicBlkRec rec;
-       char padding;
-} MosaicBlkHdrGeneric;
+#define MOSAIC_BLK_HEADER_BASE_FIELDS()\
+MosaicBlkRec rec;\
+char padding;
 
 #define MOSgetTag(Blk) (Blk->tag)
 #define MOSsetTag(Blk,Tag)  (Blk)->tag = Tag
@@ -190,7 +189,7 @@ typedef struct _MosaicEstimation {
        BUN* max_compression_length;
 } MosaicEstimation;
 
-#define GET_PADDING(blk, NAME, TPE) (((MOSBlockHeaderTpe(NAME, TPE)*) 
(blk))->base.padding)
+#define GET_PADDING(blk, NAME, TPE) (((MOSBlockHeaderTpe(NAME, TPE)*) 
(blk))->padding)
 
 #define ALIGN_BLOCK_HEADER(task, NAME, TPE)\
 {\
diff --git a/monetdb5/modules/mosaic/mosaic_delta.c 
b/monetdb5/modules/mosaic/mosaic_delta.c
--- a/monetdb5/modules/mosaic/mosaic_delta.c
+++ b/monetdb5/modules/mosaic/mosaic_delta.c
@@ -130,7 +130,7 @@ do {\
 \
        /*Add the additional sign bit to the bit count.*/\
        bits++;\
-       (PARAMETERS).base.rec.cnt = i;\
+       (PARAMETERS).rec.cnt = i;\
        (PARAMETERS).bits = bits;\
 } while(0)
 
@@ -144,13 +144,13 @@ MOSestimate_SIGNATURE(delta, TPE)\
        BUN limit = task->stop - task->start > MOSAICMAXCNT? MOSAICMAXCNT: 
task->stop - task->start;\
        MOSBlockHeaderTpe(delta, TPE) parameters;\
        determineDeltaParameters(parameters, src, limit, TPE);\
-       assert(parameters.base.rec.cnt > 0);/*Should always compress.*/\
-       current->uncompressed_size += (BUN) (parameters.base.rec.cnt * 
sizeof(TPE));\
-       current->compressed_size += 2 * sizeof(MOSBlockHeaderTpe(delta, TPE)) + 
wordaligned((parameters.base.rec.cnt * parameters.bits) / CHAR_BIT, lng);\
-       current->compression_strategy.cnt = (unsigned int) 
parameters.base.rec.cnt;\
+       assert(parameters.rec.cnt > 0);/*Should always compress.*/\
+       current->uncompressed_size += (BUN) (parameters.rec.cnt * sizeof(TPE));\
+       current->compressed_size += 2 * sizeof(MOSBlockHeaderTpe(delta, TPE)) + 
wordaligned((parameters.rec.cnt * parameters.bits) / CHAR_BIT, lng);\
+       current->compression_strategy.cnt = (unsigned int) parameters.rec.cnt;\
 \
-       if (parameters.base.rec.cnt > *current->max_compression_length ) {\
-               *current->max_compression_length = parameters.base.rec.cnt;\
+       if (parameters.rec.cnt > *current->max_compression_length ) {\
+               *current->max_compression_length = parameters.rec.cnt;\
        }\
 \
        return MAL_SUCCEED;\
diff --git a/monetdb5/modules/mosaic/mosaic_delta.h 
b/monetdb5/modules/mosaic/mosaic_delta.h
--- a/monetdb5/modules/mosaic/mosaic_delta.h
+++ b/monetdb5/modules/mosaic/mosaic_delta.h
@@ -24,8 +24,9 @@ mal_export void MOSlayout_delta(MOStask 
 
 #define MosaicBlkHeader_DEF_delta(TPE)\
 typedef struct {\
-       MosaicBlkHdrGeneric base;\
+       MosaicBlkRec rec;\
        char bits;\
+       char padding;\
        TPE init;\
        BitVectorChunk bitvector; /*First chunk of bitvector to force correct 
alignment.*/\
 } MOSBlockHeader_delta_##TPE;
diff --git a/monetdb5/modules/mosaic/mosaic_dictionary.h 
b/monetdb5/modules/mosaic/mosaic_dictionary.h
--- a/monetdb5/modules/mosaic/mosaic_dictionary.h
+++ b/monetdb5/modules/mosaic/mosaic_dictionary.h
@@ -179,7 +179,8 @@ decompress_dictionary_##TPE(TPE* dict, b
 
 #define MosaicBlkHeader_DEF_dictionary(NAME, TPE)\
 typedef struct {\
-       MosaicBlkHdrGeneric base;\
+       MosaicBlkRec rec;\
+       char padding;\
        BitVectorChunk bitvector; /*First chunk of bitvector to force correct 
alignment.*/\
 } MOSBlockHeader_##NAME##_##TPE;
 
diff --git a/monetdb5/modules/mosaic/mosaic_frame.c 
b/monetdb5/modules/mosaic/mosaic_frame.c
--- a/monetdb5/modules/mosaic/mosaic_frame.c
+++ b/monetdb5/modules/mosaic/mosaic_frame.c
@@ -128,7 +128,7 @@ do {\
        }\
        (PARAMETERS).min = min;\
        (PARAMETERS).bits = bits;\
-       (PARAMETERS).base.rec.cnt = i;\
+       (PARAMETERS).rec.cnt = i;\
 } while(0)
 
 #define MOSestimate_frame_DEF(TPE) \
@@ -141,13 +141,13 @@ MOSestimate_SIGNATURE(frame, TPE)\
        BUN limit = task->stop - task->start > MOSAICMAXCNT? MOSAICMAXCNT: 
task->stop - task->start;\
        MOSBlockHeaderTpe(frame, TPE) parameters;\
        determineFrameParameters(parameters, src, limit, TPE);\
-       assert(parameters.base.rec.cnt > 0);/*Should always compress.*/\
-       current->uncompressed_size += (BUN) (parameters.base.rec.cnt * 
sizeof(TPE));\
-       current->compressed_size += 2 * sizeof(MOSBlockHeaderTpe(frame, TPE)) + 
wordaligned((parameters.base.rec.cnt * parameters.bits) / CHAR_BIT, lng);\
-       current->compression_strategy.cnt = (unsigned int) 
parameters.base.rec.cnt;\
+       assert(parameters.rec.cnt > 0);/*Should always compress.*/\
+       current->uncompressed_size += (BUN) (parameters.rec.cnt * sizeof(TPE));\
+       current->compressed_size += 2 * sizeof(MOSBlockHeaderTpe(frame, TPE)) + 
wordaligned((parameters.rec.cnt * parameters.bits) / CHAR_BIT, lng);\
+       current->compression_strategy.cnt = (unsigned int) parameters.rec.cnt;\
 \
-       if (parameters.base.rec.cnt > *current->max_compression_length ) {\
-               *current->max_compression_length = parameters.base.rec.cnt;\
+       if (parameters.rec.cnt > *current->max_compression_length ) {\
+               *current->max_compression_length = parameters.rec.cnt;\
        }\
 \
        return MAL_SUCCEED;\
diff --git a/monetdb5/modules/mosaic/mosaic_frame.h 
b/monetdb5/modules/mosaic/mosaic_frame.h
--- a/monetdb5/modules/mosaic/mosaic_frame.h
+++ b/monetdb5/modules/mosaic/mosaic_frame.h
@@ -25,8 +25,9 @@ mal_export void MOSlayout_frame(MOStask 
 
 #define MosaicBlkHeader_DEF_frame(TPE)\
 typedef struct {\
-       MosaicBlkHdrGeneric base;\
+       MosaicBlkRec rec;\
        char bits;\
+       char padding;\
        TPE min;\
        BitVectorChunk bitvector; /*First chunk of bitvector to force correct 
alignment.*/\
 } MOSBlockHeader_frame_##TPE;
diff --git a/monetdb5/modules/mosaic/mosaic_linear.h 
b/monetdb5/modules/mosaic/mosaic_linear.h
--- a/monetdb5/modules/mosaic/mosaic_linear.h
+++ b/monetdb5/modules/mosaic/mosaic_linear.h
@@ -23,7 +23,8 @@ mal_export void MOSlayout_linear(MOStask
 
 #define MosaicBlkHeader_DEF_linear(TPE)\
 typedef struct {\
-       MosaicBlkHdrGeneric base;\
+       MosaicBlkRec rec;\
+       char padding;\
        DeltaTpe(TPE) offset;\
        DeltaTpe(TPE) step;\
 } MOSBlockHeader_linear_##TPE;
diff --git a/monetdb5/modules/mosaic/mosaic_prefix.c 
b/monetdb5/modules/mosaic/mosaic_prefix.c
--- a/monetdb5/modules/mosaic/mosaic_prefix.c
+++ b/monetdb5/modules/mosaic/mosaic_prefix.c
@@ -170,7 +170,7 @@ do {\
                assert( (prefix | (getSuffixMask(suffix_bits, TPE) & (*val))) 
== *val);\
        }\
 \
-       (PARAMETERS).base.rec.cnt = (unsigned int) i;\
+       (PARAMETERS).rec.cnt = (unsigned int) i;\
        (PARAMETERS).suffix_bits = suffix_bits;\
        (PARAMETERS).prefix = prefix;\
 } while(0)
@@ -185,11 +185,11 @@ MOSestimate_SIGNATURE(prefix, TPE)\
        BUN limit = task->stop - task->start > MOSAICMAXCNT? MOSAICMAXCNT: 
task->stop - task->start;\
        MOSBlockHeaderTpe(prefix, TPE) parameters;\
        determinePrefixParameters(parameters, src, limit, TPE);\
-       assert(parameters.base.rec.cnt > 0);/*Should always compress.*/\
+       assert(parameters.rec.cnt > 0);/*Should always compress.*/\
 \
        BUN store;\
        int bits;\
-       int i = parameters.base.rec.cnt;\
+       int i = parameters.rec.cnt;\
        bits = i * parameters.suffix_bits;\
        store = 2 * sizeof(MOSBlockHeaderTpe(prefix, TPE));\
        store += wordaligned(bits/CHAR_BIT + ((bits % CHAR_BIT) > 0), lng);\
@@ -198,10 +198,10 @@ MOSestimate_SIGNATURE(prefix, TPE)\
 \
        current->uncompressed_size += (BUN) (i * sizeof(TPE));\
        current->compressed_size += store;\
-       current->compression_strategy.cnt = (unsigned int) 
parameters.base.rec.cnt;\
+       current->compression_strategy.cnt = (unsigned int) parameters.rec.cnt;\
 \
-       if (parameters.base.rec.cnt > *current->max_compression_length ) {\
-               *current->max_compression_length = parameters.base.rec.cnt;\
+       if (parameters.rec.cnt > *current->max_compression_length ) {\
+               *current->max_compression_length = parameters.rec.cnt;\
        }\
 \
        return MAL_SUCCEED;\
diff --git a/monetdb5/modules/mosaic/mosaic_prefix.h 
b/monetdb5/modules/mosaic/mosaic_prefix.h
--- a/monetdb5/modules/mosaic/mosaic_prefix.h
+++ b/monetdb5/modules/mosaic/mosaic_prefix.h
@@ -39,8 +39,9 @@ mal_export void MOSlayout_prefix(MOStask
 
 #define MosaicBlkHeader_DEF_prefix(TPE)\
 typedef struct {\
-       MosaicBlkHdrGeneric base;\
-       int suffix_bits;\
+       MosaicBlkRec rec;\
+       char suffix_bits;\
+       char padding;\
        PrefixTpe(TPE) prefix;\
        BitVectorChunk bitvector; /*First chunk of bitvector to force correct 
alignment.*/\
 } MOSBlockHeader_prefix_##TPE;
diff --git a/monetdb5/modules/mosaic/mosaic_raw.h 
b/monetdb5/modules/mosaic/mosaic_raw.h
--- a/monetdb5/modules/mosaic/mosaic_raw.h
+++ b/monetdb5/modules/mosaic/mosaic_raw.h
@@ -23,7 +23,8 @@ mal_export void MOSlayout_raw(MOStask ta
 
 #define MosaicBlkHeader_DEF_raw(TPE)\
 typedef struct {\
-       MosaicBlkHdrGeneric base;\
+       MosaicBlkRec rec;\
+       char padding;\
     TPE init;\
 } MOSBlockHeader_raw_##TPE;
 
diff --git a/monetdb5/modules/mosaic/mosaic_runlength.h 
b/monetdb5/modules/mosaic/mosaic_runlength.h
--- a/monetdb5/modules/mosaic/mosaic_runlength.h
+++ b/monetdb5/modules/mosaic/mosaic_runlength.h
@@ -23,7 +23,8 @@ mal_export void MOSlayout_runlength(MOSt
 
 #define MosaicBlkHeader_DEF_runlength(TPE)\
 typedef struct {\
-       MosaicBlkHdrGeneric base;\
+       MosaicBlkRec rec;\
+       char padding;\
        TPE val;\
 } MOSBlockHeader_runlength_##TPE;
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to