Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvement: prevent false sharing #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions benchmark/DB_oindex.hh
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,10 @@ protected:

private:
table_type table_;
uint64_t key_gen_;
union alignas(CACHE_LINE_SIZE) {
uint64_t key_gen_;
uint8_t _[CACHE_LINE_SIZE];
};

static bool
access_all(std::array<access_t, value_container_type::num_versions>& cell_accesses, std::array<TransItem*,
Expand Down Expand Up @@ -1450,8 +1453,10 @@ public:

//private:
table_type table_;
uint64_t key_gen_;

union alignas(CACHE_LINE_SIZE) {
uint64_t key_gen_;
uint8_t _[CACHE_LINE_SIZE];
};
//static bool
//access_all(std::array<access_t, internal_elem::num_versions>&, std::array<TransItem*, internal_elem::num_versions>&, internal_elem*) {
// always_assert(false, "Not implemented.");
Expand Down
11 changes: 8 additions & 3 deletions benchmark/DB_uindex.hh
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ private:
Hash hasher_;
Pred pred_;

uint64_t key_gen_;

union alignas(CACHE_LINE_SIZE) {
uint64_t key_gen_;
uint8_t _[CACHE_LINE_SIZE];
};
// used to mark whether a key is a bucket (for bucket version checks)
// or a pointer (which will always have the lower 3 bits as 0)
static constexpr uintptr_t bucket_bit = C::item_key_tag;
Expand Down Expand Up @@ -681,7 +683,10 @@ private:
Hash hasher_;
Pred pred_;

uint64_t key_gen_;
union alignas(CACHE_LINE_SIZE) {
uint64_t key_gen_;
uint8_t _[CACHE_LINE_SIZE];
};

// used to mark whether a key is a bucket (for bucket version checks)
// or a pointer (which will always have the lower 3 bits as 0)
Expand Down