Fix performance regression from failing to optimize the new mem tracker..

This commit is contained in:
Henrik Rydgård committed 2021-03-14 21:27:20 +01:00
1 parent 6e191bb3e8
commit 63a94ceebb
1 file changed
+11 -11
+11 -11
View File
@@ -61,7 +61,7 @@ private:
// Returns the new slab after size.
Slab *Split(Slab *slab, uint32_t size);
void MergeAdjacent(Slab *slab);
bool Same(const Slab *a, const Slab *b) const;
static inline bool Same(const Slab *a, const Slab *b);
void Merge(Slab *a, Slab *b);
void FillHeads(Slab *slab);
@@ -267,6 +267,16 @@ MemSlabMap::Slab *MemSlabMap::Split(Slab *slab, uint32_t size) {
return next;
}
bool MemSlabMap::Same(const Slab *a, const Slab *b) {
if (a->allocated != b->allocated)
return false;
if (a->pc != b->pc)
return false;
if (strcmp(a->tag, b->tag))
return false;
return true;
}
void MemSlabMap::MergeAdjacent(Slab *slab) {
while (slab->next != nullptr && Same(slab, slab->next)) {
Merge(slab, slab->next);
@@ -276,16 +286,6 @@ void MemSlabMap::MergeAdjacent(Slab *slab) {
}
}
bool MemSlabMap::Same(const Slab *a, const Slab *b) const {
if (a->allocated != b->allocated)
return false;
if (a->pc != b->pc)
return false;
if (a->tag != b->tag)
return false;
return true;
}
void MemSlabMap::Merge(Slab *a, Slab *b) {
if (a->next == b) {
_assert_(a->end == b->start);