Changeset: 51c55660b7d6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/51c55660b7d6
Modified Files:
        sql/storage/store.c
Branch: iso
Log Message:

Small optimization, test if the next dependency exists in the storage before 
adding


diffs (24 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -3693,7 +3693,19 @@ transaction_add_hash_entry(sql_hash *h, 
                .ts = ts
        };
 
-       if (!hash_add(h, h->key(next_change), next_change)) {
+       int key = h->key(next_change);
+       sql_hash_e *he = h->buckets[key&(h->size-1)];
+
+       for (; he ; he = he->chain) { /* find if the entry is already present */
+               sql_dependency_change *schange = (sql_dependency_change*) 
he->value;
+
+               if (schange->objid == id && schange->ts == ts && schange->type 
== tpe) {
+                       _DELETE(next_change);
+                       return LOG_OK;
+               }
+       }
+
+       if (!hash_add(h, key, next_change)) {
                _DELETE(next_change);
                return LOG_ERR;
        }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to