MCPcopy Create free account
hub / github.com/facebook/CacheLib / insert

Method insert

cachelib/common/ApproxSplitSet.h:61–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 }
60
61 void insert(UInt key) {
62 // Rebuild at 90% full with allocation of +50% of space means minimum
63 // load factor is 60% and average is 75%.
64 // Although this computation is on the hot path, compiler elides division
65 // and benchmark shows that there is no difference performance penalty
66 // compared to storing this number precomputed.
67 if (size_ >= rehashSize()) {
68 DropSet dst{probeLimit_, rehashCapacity()};
69 for (uint32_t i = 0; i < capacity_; i++) {
70 if (table_[i] != kEmptyKey) {
71 dst.insertNoResize(table_[i]);
72 }
73 }
74 *this = std::move(dst);
75 }
76 insertNoResize(key);
77 }
78
79 bool lookup(UInt key) const {
80 uint32_t lookupProbeDistance{0};

Callers 5

toMapMethod · 0.45
insertMethod · 0.45
testAllAlignmentFunction · 0.45
TESTFunction · 0.45

Calls 1

insertNoResizeMethod · 0.80

Tested by 3

testAllAlignmentFunction · 0.36
TESTFunction · 0.36