MCPcopy Create free account
hub / github.com/GJDuck/e9patch / optimizeMappings

Function optimizeMappings

src/e9patch/e9mapping.cpp:648–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

646 */
647template <typename Key>
648void optimizeMappings(const Allocator &allocator, const size_t MAPPING_SIZE,
649 size_t granularity, MappingSet &mappings)
650{
651 Radix::Node<Key> *tree = nullptr;
652 for (auto mapping: mappings)
653 {
654 Key key = calculateKey<Key>(allocator, MAPPING_SIZE, mapping);
655 tree = merge(tree, key, mapping);
656 }
657 log(COLOR_NONE, '\n');
658
659 mappings.clear();
660 collectMappings(tree, mappings);
661 log(COLOR_NONE, '\n');
662
663 for (auto mapping: mappings)
664 shrinkMapping(mapping, granularity);
665}
666template
667void optimizeMappings<Key128>(const Allocator &allocator,
668 const size_t MAPPING_SIZE, size_t granularity, MappingSet &mappings);

Callers

nothing calls this directly

Calls 4

mergeFunction · 0.85
logFunction · 0.85
collectMappingsFunction · 0.85
shrinkMappingFunction · 0.85

Tested by

no test coverage detected