Skip to content

Commit

Permalink
Use tsl::ordered_set for attribute storage
Browse files Browse the repository at this point in the history
  • Loading branch information
systemed committed Sep 19, 2023
1 parent adcdb6e commit e2f6e17
Show file tree
Hide file tree
Showing 4 changed files with 2,542 additions and 12 deletions.
8 changes: 4 additions & 4 deletions include/attribute_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <boost/functional/hash.hpp>
#include <vector>
#include <unordered_map>
#include <tsl/ordered_set.h>

/* AttributeStore - global dictionary for attributes */

Expand Down Expand Up @@ -101,9 +102,9 @@ struct AttributeSet {

// AttributeStore is the store for all AttributeSets
struct AttributeStore {
std::vector<AttributeSet> attribute_sets;
std::unordered_map<AttributeSet, AttributeIndex, AttributeSet::hash_function> attribute_indices;
tsl::ordered_set<AttributeSet, AttributeSet::hash_function> attribute_sets;
mutable std::mutex mutex;
int lookups=0;

AttributeIndex add(AttributeSet const &attributes);
std::set<AttributePair, AttributeSet::key_value_less> get(AttributeIndex index) const;
Expand All @@ -113,8 +114,7 @@ struct AttributeStore {
AttributeStore() {
// Initialise with an empty set at position 0
AttributeSet blank;
attribute_sets.emplace_back(blank);
attribute_indices.emplace(blank,0);
attribute_sets.insert(blank);
}
};

Expand Down
Loading

0 comments on commit e2f6e17

Please sign in to comment.