Final Cleanup (hopefully) and including some performance numbers.

I microbenchmarked the storage queue standalone. i.e. the set and clearrange mutations
were performed solely at the in-memory storage queue. No other FDB components were involved
in this test. And hence the numbers presented here the best case numbers.

Test setup:
- 100M mutations: about 5% clearRange and 95% set mutations
- 100M rangeReads
- Keys/Values generated using deterministicRandom()
- A new version generated for each mutation (i.e. it's an extreme version test)

Performance comparison between std::map and std::deque for VersionedMap"

                                      std::map    std::deque
Time to perform the mutations         220.066     218.784
Time to perform buffered readRange    184.423     171.578
This commit is contained in:
negoyal 2019-09-04 11:29:29 -07:00
parent 91020abb5a
commit 9d334948b1
1 changed files with 8 additions and 10 deletions

View File

@ -475,8 +475,9 @@ public:
Version oldestVersion, latestVersion;
// This deque keeps track of PTree root nodes at various versions. Since the versions increase monotonically, the deque is
// implicitly sorted and hence binary-searchable.
// This deque keeps track of PTree root nodes at various versions. Since the
// versions increase monotonically, the deque is implicitly sorted and hence
// binary-searchable.
std::deque<std::pair<Version, Tree>> roots;
struct compare {
@ -522,9 +523,9 @@ public:
auto r = upper_bound(roots.begin(), roots.end(), newOldestVersion, compare());
auto upper = r;
--r;
// if the specified newOldestVersion does not exist, copy the root from next lower version to newOldestVersion position
// if the specified newOldestVersion does not exist, insert a new
// entry-pair with newOldestVersion and the root from next lower version
if (r->first != newOldestVersion) {
//r = roots.emplace(upper, *r);
r = roots.emplace(upper, newOldestVersion, getRoot(newOldestVersion));
}
@ -538,12 +539,9 @@ public:
auto r = upper_bound(roots.begin(), roots.end(), newOldestVersion, compare());
auto upper = r;
--r;
// if the specified newOldestVersion does not exist, copy the root from next lower version to newOldestVersion position
//if (!binary_search(roots.begin(), roots.end(), newOldestVersion, compare())) {
// roots.emplace(upper_bound(roots.begin(), roots.end(), newOldestVersion, compare()), newOldestVersion, getRoot(newOldestVersion));
//}
// if the specified newOldestVersion does not exist, insert a new
// entry-pair with newOldestVersion and the root from next lower version
if (r->first != newOldestVersion) {
//r = roots.emplace(upper, *r);
r = roots.emplace(upper, newOldestVersion, getRoot(newOldestVersion));
}
@ -551,7 +549,7 @@ public:
vector<Tree> toFree;
toFree.reserve(10000);
auto newBegin = r; //lower_bound(roots.begin(), roots.end(), newOldestVersion, compare());
auto newBegin = r;
Tree *lastRoot = nullptr;
for(auto root = roots.begin(); root != newBegin; ++root) {
if(root->second) {