diff options
author | Liran Schour <lirans@il.ibm.com> | 2016-07-18 11:45:54 +0300 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-07-18 22:58:44 -0700 |
commit | f0d7ae1951d81a4579d732f40cafdcade1e2b587 (patch) | |
tree | 9aac39a3f6495955d8a4a121ff42e16c8fe17ecc /ovsdb/condition.h | |
parent | 845a1187073a7ee1ead82ba0391f834e39124a5d (diff) | |
download | openvswitch-f0d7ae1951d81a4579d732f40cafdcade1e2b587.tar.gz |
ovsdb: optimize match_any_clause() condition evaluation
Optimize ovsdb_condition_match_any_clause() to be in O(#columns in condition)
and not O(#clauses) in case condition's caluses function is boolean or "==".
Signed-off-by: Liran Schour <lirans@il.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovsdb/condition.h')
-rw-r--r-- | ovsdb/condition.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ovsdb/condition.h b/ovsdb/condition.h index 443c8eeca..2ddc811dd 100644 --- a/ovsdb/condition.h +++ b/ovsdb/condition.h @@ -62,9 +62,12 @@ struct ovsdb_clause { struct ovsdb_condition { struct ovsdb_clause *clauses; size_t n_clauses; + bool optimized; + struct shash o_columns; }; -#define OVSDB_CONDITION_INITIALIZER { NULL, 0} +#define OVSDB_CONDITION_INITIALIZER(COND) \ + { NULL, 0, true, SHASH_INITIALIZER(&(COND)->o_columns)} void ovsdb_condition_init(struct ovsdb_condition *); bool ovsdb_condition_empty(const struct ovsdb_condition *); |