Changeset: 105d9b13c0b7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/105d9b13c0b7
Modified Files:
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_hash.c
gdk/gdk_private.h
gdk/gdk_select.c
gdk/gdk_utils.c
Branch: default
Log Message:
Use all caps names for defines, and use those as defaults.
diffs (197 lines):
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1087,7 +1087,7 @@ BUNappendmulti(BAT *b, const void *value
return rc;
}
- if (count > BATcount(b) / GDK_UNIQUE_ESTIMATE_KEEP_FRACTION) {
+ if (count > BATcount(b) / gdk_unique_estimate_keep_fraction) {
MT_lock_set(&b->theaplock);
b->tunique_est = 0;
MT_lock_unset(&b->theaplock);
@@ -1383,7 +1383,7 @@ BUNdelete(BAT *b, oid o)
b->tnorevsorted = 0;
MT_lock_set(&b->theaplock);
b->batCount--;
- if (BATcount(b) < GDK_UNIQUE_ESTIMATE_KEEP_FRACTION)
+ if (BATcount(b) < gdk_unique_estimate_keep_fraction)
b->tunique_est = 0;
MT_lock_unset(&b->theaplock);
if (b->batCount <= 1) {
@@ -1435,7 +1435,7 @@ BUNinplacemulti(BAT *b, const oid *posit
b->tminpos = BUN_NONE;
b->tmaxpos = BUN_NONE;
b->tunique_est = 0.0;
- } else if (count > BATcount(b) / GDK_UNIQUE_ESTIMATE_KEEP_FRACTION) {
+ } else if (count > BATcount(b) / gdk_unique_estimate_keep_fraction) {
b->tunique_est = 0;
}
MT_lock_unset(&b->theaplock);
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -706,7 +706,7 @@ BATappend2(BAT *b, BAT *n, BAT *s, bool
b->tminpos = BUN_NONE;
}
}
- if (cnt > BATcount(b) / GDK_UNIQUE_ESTIMATE_KEEP_FRACTION) {
+ if (cnt > BATcount(b) / gdk_unique_estimate_keep_fraction) {
b->tunique_est = 0;
}
MT_lock_unset(&b->theaplock);
@@ -1094,7 +1094,7 @@ BATappend_or_update(BAT *b, BAT *p, cons
IMPSdestroy(b);
STRMPdestroy(b);
MT_lock_set(&b->theaplock);
- if (ni.count > BATcount(b) / GDK_UNIQUE_ESTIMATE_KEEP_FRACTION) {
+ if (ni.count > BATcount(b) / gdk_unique_estimate_keep_fraction) {
b->tunique_est = 0;
}
MT_lock_unset(&b->theaplock);
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -1106,7 +1106,7 @@ HASHappend_locked(BAT *b, BUN i, const v
return;
}
assert(i * h->width == h->heaplink.free);
- if (h->nunique < b->batCount / HASH_DESTROY_UNIQUES_FRACTION) {
+ if (h->nunique < b->batCount / hash_destroy_uniques_fraction) {
b->thash = NULL;
doHASHdestroy(b, h);
GDKclrerr();
@@ -1180,7 +1180,7 @@ HASHinsert_locked(BAT *b, BUN p, const v
return;
}
assert(p * h->width < h->heaplink.free);
- if (h->nunique < b->batCount / HASH_DESTROY_UNIQUES_FRACTION) {
+ if (h->nunique < b->batCount / hash_destroy_uniques_fraction) {
b->thash = NULL;
doHASHdestroy(b, h);
GDKclrerr();
@@ -1264,7 +1264,7 @@ HASHdelete_locked(BAT *b, BUN p, const v
return;
}
assert(p * h->width < h->heaplink.free);
- if (h->nunique < b->batCount / HASH_DESTROY_UNIQUES_FRACTION) {
+ if (h->nunique < b->batCount / hash_destroy_uniques_fraction) {
b->thash = NULL;
doHASHdestroy(b, h);
GDKclrerr();
@@ -1320,7 +1320,7 @@ HASHdelete_locked(BAT *b, BUN p, const v
break;
}
hb = hb2;
- if (++links > HASH_DESTROY_CHAIN_LENGTH) {
+ if (++links > hash_destroy_chain_length) {
b->thash = NULL;
doHASHdestroy(b, h);
GDKclrerr();
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -471,16 +471,20 @@ extern MT_Lock GDKtmLock;
/* when the number of updates to a BAT is less than 1 in this number, we
* keep the unique_est property */
-extern BUN GDK_UNIQUE_ESTIMATE_KEEP_FRACTION; /* should become a define once */
+#define GDK_UNIQUE_ESTIMATE_KEEP_FRACTION 1000
+extern BUN gdk_unique_estimate_keep_fraction; /* should become a define once */
/* if the number of unique values is less than 1 in this number, we
* destroy the hash rather than update it in HASH{append,insert,delete} */
-extern BUN HASH_DESTROY_UNIQUES_FRACTION; /* likewise */
+#define HASH_DESTROY_UNIQUES_FRACTION 1000
+extern BUN hash_destroy_uniques_fraction; /* likewise */
/* if the estimated number of unique values is less than 1 in this
* number, don't build a hash table to do a hashselect */
-extern dbl NO_HASH_SELECT_FRACTION; /* same here */
+#define NO_HASH_SELECT_FRACTION 1000
+extern dbl no_hash_select_fraction; /* same here */
/* if the hash chain is longer than this number, we delete the hash
* rather than maintaining it in HASHdelete */
-extern BUN HASH_DESTROY_CHAIN_LENGTH;
+#define HASH_DESTROY_CHAIN_LENGTH 1000
+extern BUN hash_destroy_chain_length;
#if !defined(NDEBUG) && !defined(__COVERITY__)
/* see comment in gdk.h */
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -1606,7 +1606,7 @@ BATselect(BAT *b, BAT *s, const void *tl
if (wanthash && !havehash) {
MT_lock_set(&b->theaplock);
if (b->tunique_est != 0 &&
- b->tunique_est < BATcount(b) /
NO_HASH_SELECT_FRACTION) {
+ b->tunique_est < BATcount(b) /
no_hash_select_fraction) {
/* too many duplicates: not worth it */
wanthash = false;
}
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -59,16 +59,16 @@ static void GDKunlockHome(int farmid);
/* when the number of updates to a BAT is less than 1 in this number, we
* keep the unique_est property */
-BUN GDK_UNIQUE_ESTIMATE_KEEP_FRACTION = 1000; /* should become a define once */
+BUN gdk_unique_estimate_keep_fraction = GDK_UNIQUE_ESTIMATE_KEEP_FRACTION; /*
should become a define once */
/* if the number of unique values is less than 1 in this number, we
* destroy the hash rather than update it in HASH{append,insert,delete} */
-BUN HASH_DESTROY_UNIQUES_FRACTION = 1000; /* likewise */
+BUN hash_destroy_uniques_fraction = HASH_DESTROY_UNIQUES_FRACTION; /*
likewise */
/* if the estimated number of unique values is less than 1 in this
* number, don't build a hash table to do a hashselect */
-dbl NO_HASH_SELECT_FRACTION = 1000; /* same here */
+dbl no_hash_select_fraction = NO_HASH_SELECT_FRACTION; /* same here
*/
/* if the hash chain is longer than this number, we delete the hash
* rather than maintaining it in HASHdelete */
-BUN HASH_DESTROY_CHAIN_LENGTH = 1000;
+BUN hash_destroy_chain_length = HASH_DESTROY_CHAIN_LENGTH;
/*
* @+ Monet configuration file
@@ -1157,26 +1157,26 @@ GDKinit(opt *set, int setlen, bool embed
TRC_CRITICAL(GDK, "GDKsetenv revision failed");
return GDK_FAIL;
}
- GDK_UNIQUE_ESTIMATE_KEEP_FRACTION = 0;
+ gdk_unique_estimate_keep_fraction = 0;
if ((p = GDKgetenv("gdk_unique_estimate_keep_fraction")) != NULL)
- GDK_UNIQUE_ESTIMATE_KEEP_FRACTION = (BUN) strtoll(p, NULL, 10);
- if (GDK_UNIQUE_ESTIMATE_KEEP_FRACTION == 0)
- GDK_UNIQUE_ESTIMATE_KEEP_FRACTION = 1000;
- HASH_DESTROY_UNIQUES_FRACTION = 0;
+ gdk_unique_estimate_keep_fraction = (BUN) strtoll(p, NULL, 10);
+ if (gdk_unique_estimate_keep_fraction == 0)
+ gdk_unique_estimate_keep_fraction =
GDK_UNIQUE_ESTIMATE_KEEP_FRACTION;
+ hash_destroy_uniques_fraction = 0;
if ((p = GDKgetenv("hash_destroy_uniques_fraction")) != NULL)
- HASH_DESTROY_UNIQUES_FRACTION = (BUN) strtoll(p, NULL, 10);
- if (HASH_DESTROY_UNIQUES_FRACTION == 0)
- HASH_DESTROY_UNIQUES_FRACTION =
GDK_UNIQUE_ESTIMATE_KEEP_FRACTION;
- NO_HASH_SELECT_FRACTION = 0;
+ hash_destroy_uniques_fraction = (BUN) strtoll(p, NULL, 10);
+ if (hash_destroy_uniques_fraction == 0)
+ hash_destroy_uniques_fraction = HASH_DESTROY_UNIQUES_FRACTION;
+ no_hash_select_fraction = 0;
if ((p = GDKgetenv("no_hash_select_fraction")) != NULL)
- NO_HASH_SELECT_FRACTION = (dbl) strtoll(p, NULL, 10);
- if (NO_HASH_SELECT_FRACTION == 0)
- NO_HASH_SELECT_FRACTION = (dbl)
GDK_UNIQUE_ESTIMATE_KEEP_FRACTION;
- HASH_DESTROY_CHAIN_LENGTH = 0;
+ no_hash_select_fraction = (dbl) strtoll(p, NULL, 10);
+ if (no_hash_select_fraction == 0)
+ no_hash_select_fraction = NO_HASH_SELECT_FRACTION;
+ hash_destroy_chain_length = 0;
if ((p = GDKgetenv("hash_destroy_chain_length")) != NULL)
- HASH_DESTROY_CHAIN_LENGTH = (BUN) strtoll(p, NULL, 10);
- if (HASH_DESTROY_CHAIN_LENGTH == 0)
- HASH_DESTROY_CHAIN_LENGTH = 1000;
+ hash_destroy_chain_length = (BUN) strtoll(p, NULL, 10);
+ if (hash_destroy_chain_length == 0)
+ hash_destroy_chain_length = HASH_DESTROY_CHAIN_LENGTH;
return GDK_SUCCEED;
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]