Changeset: 71f095d0938c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=71f095d0938c Modified Files: gdk/gdk_group.c Branch: Jul2017 Log Message:
Move cand and grps test out of the inner loop.
diffs (82 lines):
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -98,24 +98,64 @@
#define GRP_compare_consecutive_values(INIT_0,INIT_1,COMP,KEEP)
\
do { \
INIT_0; \
- for (r = 0; r < cnt; r++) { \
- if (cand) { \
+ if (cand && grps) { \
+ for (r = 0; r < cnt; r++) { \
p = *cand++ - b->hseqbase; \
- } else { \
- p = start++; \
+ assert(p < end); \
+ INIT_1; \
+ if (ngrp == 0 || grps[r] != prev || COMP) { \
+ GRPnotfound(); \
+ } else { \
+ ngrps[r] = ngrp - 1; \
+ if (histo) \
+ cnts[ngrp - 1]++; \
+ } \
+ KEEP; \
+ prev = grps[r]; \
} \
- assert(p < end); \
- INIT_1; \
- if (ngrp == 0 || (grps && grps[r] != prev) || COMP) { \
- GRPnotfound(); \
- } else { \
- ngrps[r] = ngrp - 1; \
- if (histo) \
- cnts[ngrp - 1]++; \
+ } else if (cand) { \
+ for (r = 0; r < cnt; r++) { \
+ p = *cand++ - b->hseqbase; \
+ assert(p < end); \
+ INIT_1; \
+ if (ngrp == 0 || COMP) { \
+ GRPnotfound(); \
+ } else { \
+ ngrps[r] = ngrp - 1; \
+ if (histo) \
+ cnts[ngrp - 1]++; \
+ } \
+ KEEP; \
} \
- KEEP; \
- if (grps) \
+ } else if (grps) { \
+ for (r = 0; r < cnt; r++) { \
+ p = start++; \
+ assert(p < end); \
+ INIT_1; \
+ if (ngrp == 0 || grps[r] != prev || COMP) { \
+ GRPnotfound(); \
+ } else { \
+ ngrps[r] = ngrp - 1; \
+ if (histo) \
+ cnts[ngrp - 1]++; \
+ } \
+ KEEP; \
prev = grps[r]; \
+ } \
+ } else { \
+ for (r = 0; r < cnt; r++) { \
+ p = start++; \
+ assert(p < end); \
+ INIT_1; \
+ if (ngrp == 0 || COMP) { \
+ GRPnotfound(); \
+ } else { \
+ ngrps[r] = ngrp - 1; \
+ if (histo) \
+ cnts[ngrp - 1]++; \
+ } \
+ KEEP; \
+ } \
} \
} while(0)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list
