Skip to content

Commit 1bfd3ff

Browse files
committed
Disabling the inlining of Contains.
1 parent 2b33ef5 commit 1bfd3ff

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

benchmarks/bulk-insert-and-query.cc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ struct Statistics {
6666
double bits_per_item;
6767
};
6868

69+
//
70+
// Inlining the "contains" which are executed within a tight loop can be both
71+
// very detrimental or very beneficial, and which ways it goes depends on the
72+
// compiler. It is unclear whether we want to benchmark the inlining of Contains,
73+
// as it depends very much on how "contains" is used. So it is maybe reasonable
74+
// to benchmark it without inlining.
75+
//
76+
#define CONTAIN_ATTRIBUTES __attribute__ ((noinline))
77+
6978
// Output for the first row of the table of results. type_width is the maximum number of
7079
// characters of the description of any table type, and find_percent_count is the number
7180
// of different lookup statistics gathered for each table. This function assumes the
@@ -133,6 +142,8 @@ struct FilterAPI<CuckooFilter<ItemType, bits_per_item, TableType, HashFamily>> {
133142
}
134143
static void AddAll(const vector<ItemType> keys, const size_t start, const size_t end, Table* table) {
135144
}
145+
146+
CONTAIN_ATTRIBUTES
136147
static bool Contain(uint64_t key, const Table * table) {
137148
return (0 == table->Contain(key));
138149
}
@@ -167,6 +178,8 @@ struct FilterAPI<SimdBlockFilter<HashFamily>> {
167178
}
168179
static void AddAll(const vector<uint64_t> keys, const size_t start, const size_t end, Table* table) {
169180
}
181+
182+
CONTAIN_ATTRIBUTES
170183
static bool Contain(uint64_t key, const Table * table) {
171184
return table->Find(key);
172185
}
@@ -184,6 +197,8 @@ struct FilterAPI<SimdBlockFilterFixed<HashFamily>> {
184197
}
185198
static void AddAll(const vector<uint64_t> keys, const size_t start, const size_t end, Table* table) {
186199
}
200+
201+
CONTAIN_ATTRIBUTES
187202
static bool Contain(uint64_t key, const Table * table) {
188203
return table->Find(key);
189204
}
@@ -200,6 +215,8 @@ struct FilterAPI<XorFilter<ItemType, FingerprintType>> {
200215
static void AddAll(const vector<ItemType> keys, const size_t start, const size_t end, Table* table) {
201216
table->AddAll(keys, start, end);
202217
}
218+
219+
CONTAIN_ATTRIBUTES
203220
static bool Contain(uint64_t key, const Table * table) {
204221
return (0 == table->Contain(key));
205222
}
@@ -214,6 +231,8 @@ struct FilterAPI<XorFilter<ItemType, FingerprintType, HashFamily>> {
214231
static void AddAll(const vector<ItemType> keys, const size_t start, const size_t end, Table* table) {
215232
table->AddAll(keys, start, end);
216233
}
234+
235+
CONTAIN_ATTRIBUTES
217236
static bool Contain(uint64_t key, const Table * table) {
218237
return (0 == table->Contain(key));
219238
}
@@ -228,6 +247,8 @@ struct FilterAPI<XorFilter2<ItemType, FingerprintType, FingerprintStorageType, H
228247
static void AddAll(const vector<ItemType> keys, const size_t start, const size_t end, Table* table) {
229248
table->AddAll(keys, start, end);
230249
}
250+
251+
CONTAIN_ATTRIBUTES
231252
static bool Contain(uint64_t key, const Table * table) {
232253
return (0 == table->Contain(key));
233254
}
@@ -242,6 +263,8 @@ struct FilterAPI<XorFilter2n<ItemType, FingerprintType, FingerprintStorageType,
242263
static void AddAll(const vector<ItemType> keys, const size_t start, const size_t end, Table* table) {
243264
table->AddAll(keys, start, end);
244265
}
266+
267+
CONTAIN_ATTRIBUTES
245268
static bool Contain(uint64_t key, const Table * table) {
246269
return (0 == table->Contain(key));
247270
}
@@ -256,6 +279,8 @@ struct FilterAPI<XorFilterPlus<ItemType, FingerprintType, HashFamily>> {
256279
static void AddAll(const vector<ItemType> keys, const size_t start, const size_t end, Table* table) {
257280
table->AddAll(keys, start, end);
258281
}
282+
283+
CONTAIN_ATTRIBUTES
259284
static bool Contain(uint64_t key, const Table * table) {
260285
return (0 == table->Contain(key));
261286
}
@@ -270,6 +295,8 @@ struct FilterAPI<GcsFilter<ItemType, bits_per_item, HashFamily>> {
270295
static void AddAll(const vector<ItemType> keys, const size_t start, const size_t end, Table* table) {
271296
table->AddAll(keys, start, end);
272297
}
298+
299+
CONTAIN_ATTRIBUTES
273300
static bool Contain(uint64_t key, const Table * table) {
274301
return (0 == table->Contain(key));
275302
}
@@ -285,6 +312,8 @@ struct FilterAPI<GQFilter<ItemType, bits_per_item, HashFamily>> {
285312
}
286313
static void AddAll(const vector<ItemType> keys, const size_t start, const size_t end, Table* table) {
287314
}
315+
316+
CONTAIN_ATTRIBUTES
288317
static bool Contain(uint64_t key, const Table * table) {
289318
return (0 == table->Contain(key));
290319
}
@@ -300,6 +329,8 @@ struct FilterAPI<BloomFilter<ItemType, bits_per_item, HashFamily>> {
300329
}
301330
static void AddAll(const vector<ItemType> keys, const size_t start, const size_t end, Table* table) {
302331
}
332+
333+
CONTAIN_ATTRIBUTES
303334
static bool Contain(uint64_t key, const Table * table) {
304335
return (0 == table->Contain(key));
305336
}

0 commit comments

Comments
 (0)