MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / resize

Method resize

libCacheSim/dataStructure/sparsepp/spp.h:2842–2849  ·  view source on GitHub ↗

Though the docs say this should be num_buckets, I think it's much more useful as num_elements. As a special feature, calling with req_elements==0 will cause us to shrink if we can, saving space. -----------------------------------------------------------------

Source from the content-addressed store, hash-verified

2840 // req_elements==0 will cause us to shrink if we can, saving space.
2841 // -----------------------------------------------------------------
2842 void resize(size_type req_elements)
2843 {
2844 // resize to this or larger
2845 if (settings.consider_shrink() || req_elements == 0)
2846 _maybe_shrink();
2847 if (req_elements > table.num_nonempty()) // we only grow
2848 _resize_delta((size_type)(req_elements - table.num_nonempty()));
2849 }
2850
2851 // Get and change the value of shrink_factor and enlarge_factor. The
2852 // description at the beginning of this file explains how to choose

Callers

nothing calls this directly

Calls 2

consider_shrinkMethod · 0.80
num_nonemptyMethod · 0.45

Tested by

no test coverage detected