Changeset: b2d3bc727be6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b2d3bc727be6
Modified Files:
monetdb5/modules/mosaic/mosaic.h
monetdb5/modules/mosaic/mosaic_frame.c
monetdb5/modules/mosaic/mosaic_hdr.c
Branch: mosaic
Log Message:
Did some work pushing dictionary to block header. But that is not warranted.
diffs (109 lines):
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
@@ -68,20 +68,6 @@ typedef struct MOSAICHEADER{
// both dictionary and framebased compression require a global
dictionary of frequent values
// Their size is purposely topped
bte mask, bits, framebits; // global compression type properties
- int dictsize; // used by capped compression, it is a small
table
- union{
- bte valbte[256];
- sht valsht[256];
- int valint[256];
- lng vallng[256];
- oid valoid[256];
- flt valflt[256];
- dbl valdbl[256];
-#ifdef HAVE_HGE
- hge valhge[256];
-#endif
- }dict;
- lng dictfreq[256];// keep track on their use
// collect compression statistics for the particular task
// A value of METHOD_NOT_AVAILABLE in blks or elms indicates that the
corresponding method wasn't considered as candidate.
flt ratio; //compresion ratio
@@ -127,6 +113,8 @@ typedef struct MOSAICBLK{
// TODO: check if this function can be added to gdk_atoms.h
#define is_nil(TPE, v) (ATOMcmp( TYPE_##TPE , (void*) &(v), (void*)
ATOMnilptr(TYPE_##TPE) ) == 0)
+#define getSrc(TPE, TASK) (((TPE*)TASK->src) + TASK->start)
+
/* The (de) compression task descriptor */
typedef struct MOSTASK{
int type; // one of the permissible compression types
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
@@ -88,16 +88,6 @@ MOSskip_frame(MOStask task)
task->blk = 0; // ENDOFLIST
}
-#define MOSfind(RES,DICT,VAL,F,L)\
-{ int m,f= F, l=L; \
- while( l-f > 0 ) { \
- m = f + (l-f)/2;\
- if ( VAL < DICT[m] ) l=m-1; else f= m;\
- if ( VAL > DICT[m] ) f=m+1; else l= m;\
- }\
- RES= f;\
-}
-
typedef struct _FrameParameters_t {
MosaicBlkRec base;
int bits;
@@ -124,7 +114,7 @@ typedef struct _FrameParameters_t {
} MosaicBlkHeader_frame_t;
-#define MOScodevectorFrame(Task) (((char*) (Task)->blk)+
wordaligned(sizeof(MosaicBlkHeader_frame_t),lng))
+#define MOScodevectorFrame(Task) (((char*) (Task)->blk)+
wordaligned(sizeof(MosaicBlkHeader_frame_t), BitVector))
/* Use ternary operator because (in theory) we have to be careful not to get
overflow's*/\
#define GET_DELTA_FOR_SIGNED_TYPE(DELTA_TPE, max, min) (min < 0? max <
0?(DELTA_TPE) (max - min) : (DELTA_TPE)(max) + (DELTA_TPE)(-1 * min) :
(DELTA_TPE) (max - min))
@@ -169,27 +159,20 @@ do {\
(PARAMETERS).base.cnt = i;\
} while(0)
-#define getSrc(TPE, TASK) (((TPE*)TASK->src) + TASK->start)
-
#define estimateFrame(TASK, TPE, DELTA_TPE, GET_DELTA)\
do {\
TPE *src = getSrc(TPE, (TASK));\
BUN limit = (TASK)->stop - (TASK)->start > MOSAICMAXCNT? MOSAICMAXCNT:
(TASK)->stop - (TASK)->start;\
MosaicBlkHeader_frame_t parameters;\
determineFrameParameters(parameters, src, limit, TPE, DELTA_TPE,
GET_DELTA);\
- assert(parameters.base.cnt > 0);/*Should always compress.*/\
- current->is_applicable = true;\
- current->uncompressed_size += (BUN) (parameters.base.cnt *
sizeof(TPE));\
- current->compressed_size +=
wordaligned(sizeof(MosaicBlkHeader_frame_t), lng) +
wordaligned((parameters.base.cnt * parameters.bits) / CHAR_BIT, lng);\
- current->compression_strategy.cnt = (unsigned int) parameters.base.cnt;\
+ if(parameters.base.cnt) (TASK)->factor[MOSAIC_FRAME] = (flt) ((int)
(parameters.base.cnt) * sizeof(TPE)) /
(wordaligned(sizeof(MosaicBlkHeader_frame_t), BitVector) +
wordaligned((parameters.base.cnt * parameters.bits) / CHAR_BIT, BitVector));\
+ else (TASK)->factor[MOSAIC_FRAME] = 0.0;\
+ (TASK)->range[MOSAIC_FRAME] = task->start + parameters.base.cnt;\
} while (0)
// calculate the expected reduction using dictionary in terms of elements
compressed
-str
-MOSestimate_frame(MOStask task, MosaicEstimation* current, const
MosaicEstimation* previous) {
- (void) previous;
- current->is_applicable = true;
- current->compression_strategy.tag = MOSAIC_FRAME;
+flt
+MOSestimate_frame(MOStask task) {
switch(ATOMbasetype(task->type)){
case TYPE_bte: estimateFrame(task, bte, ulng,
GET_DELTA_FOR_SIGNED_TYPE); break;
diff --git a/monetdb5/modules/mosaic/mosaic_hdr.c
b/monetdb5/modules/mosaic/mosaic_hdr.c
--- a/monetdb5/modules/mosaic/mosaic_hdr.c
+++ b/monetdb5/modules/mosaic/mosaic_hdr.c
@@ -47,10 +47,6 @@ MOSinitHeader(MOStask task)
hdr->top = 0;
hdr->checksum.sumlng = 0;
hdr->checksum2.sumlng = 0;
-
- for(i=0; i < 256; i++){
- hdr->dictfreq[i]=0;
- }
}
// position the task on the mosaic blk to be scanned
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list