File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -318,6 +318,7 @@ class MortonFilter {
318318 size_t size;
319319public:
320320 MortonFilter (const size_t size) {
321+ // filter = new Morton3_8((size_t) (size / 0.50) + 64);
321322 filter = new Morton3_8 ((size_t ) (2.1 * size) + 64 );
322323 this ->size = size;
323324 }
@@ -331,8 +332,14 @@ class MortonFilter {
331332 return filter->likely_contains (item);
332333 };
333334 size_t SizeInBytes () const {
334- // TODO don't know how to get / calculate it
335- return size;
335+ // according to morton_sample_configs.h:
336+ // Morton3_8 - 3-slot buckets with 8-bit fingerprints: 11.7 bits/item
337+ // (load factor = 0.95)
338+ // so in theory we could just hardcode the size here,
339+ // and don't measure it
340+ // return (size_t)((size * 11.7) / 8);
341+
342+ return filter->SizeInBytes ();
336343 }
337344};
338345
Original file line number Diff line number Diff line change @@ -258,6 +258,8 @@ namespace CompressedCuckoo{
258258 // The number of times that we've doubled the filter's capacity
259259 uint_fast16_t _resize_count;
260260
261+ size_t sizeInBytes;
262+
261263 friend Tester; // Class with a bunch of test functions in test.cc
262264
263265 public:
@@ -275,6 +277,11 @@ namespace CompressedCuckoo{
275277 _resize_count(0 )
276278 {
277279
280+ sizeInBytes = 0 ;
281+ sizeInBytes += sizeof (bool ) * (_block_fullness_array_enabled ? _total_blocks : 0 );
282+ sizeInBytes += sizeof (counter_t ) * (_buckets_per_block + 1 );
283+ sizeInBytes += sizeof (block_t ) * _total_blocks;
284+
278285 // Supporting dual use as a compressed cuckoo filter and Morton filter
279286 static_assert ((_morton_filter_functionality_enabled ^ (_ota_len_bits == 0 )),
280287 " ERROR: If Morton filter functionality is enabled, then the overflow tracking array must be at least one bit in length." );
@@ -335,6 +342,9 @@ namespace CompressedCuckoo{
335342 }
336343 }
337344
345+ size_t SizeInBytes () {
346+ return sizeInBytes;
347+ }
338348
339349 INLINE atom_t fingerprint_function (const hash_t raw_hash) const {
340350 atom_t fingerprint =
You can’t perform that action at this time.
0 commit comments