1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

fix(allocator,perf): performance degradation caused by lack of STLPoolAllocator replaced by CountingAllocator

This commit is contained in:
=
2025-04-24 13:45:33 +00:00
committed by drrtuy
parent 6fb18b457c
commit 671b7301f3
7 changed files with 182 additions and 92 deletions

View File

@ -774,15 +774,12 @@ void IdbOrderBy::initialize(const RowGroup& rg)
fRowGroup.initRow(&row2);
// These two blocks contain structs with memory accounting.
{
auto alloc = fRm->getAllocator<OrderByRow>();
fOrderByQueue.reset(new SortingPQ(rowgroup::rgCommonSize, alloc));
}
fOrderByQueue.reset(new SortingPQ(rowgroup::rgCommonSize, fRm->getAllocator<OrderByRow>()));
if (fDistinct)
{
auto alloc = fRm->getAllocator<rowgroup::Row::Pointer>();
fDistinctMap.reset(new DistinctMap_t(10, Hasher(this, getKeyLength()), Eq(this, getKeyLength()), alloc));
fDistinctMap.reset(new DistinctMap_t(10, Hasher(this, getKeyLength()), Eq(this, getKeyLength()),
utils::STLPoolAllocator<rowgroup::Row::Pointer>(fRm)));
}
}

View File

@ -36,7 +36,7 @@
#include "resourcemanager.h"
#include "rowgroup.h"
#include "hasher.h"
// #include "stlpoolallocator.h"
#include "stlpoolallocator.h"
// forward reference
namespace joblist
@ -81,6 +81,31 @@ class ReservablePQ : private std::priority_queue<_Tp, _Sequence, _Compare>
using std::priority_queue<_Tp, _Sequence, _Compare>::empty;
};
// template <typename _Tp, typename _Sequence = std::vector<_Tp>,
// typename _Compare = std::less<typename _Sequence::value_type> >
// class ReservablePQ : private std::priority_queue<_Tp, _Sequence, _Compare>
// {
// public:
// typedef typename std::priority_queue<_Tp, _Sequence, _Compare>::size_type size_type;
// explicit ReservablePQ(size_type capacity = 0)
// {
// reserve(capacity);
// };
// void reserve(size_type capacity)
// {
// this->c.reserve(capacity);
// }
// size_type capacity() const
// {
// return this->c.capacity();
// }
// using std::priority_queue<_Tp, _Sequence, _Compare>::size;
// using std::priority_queue<_Tp, _Sequence, _Compare>::top;
// using std::priority_queue<_Tp, _Sequence, _Compare>::pop;
// using std::priority_queue<_Tp, _Sequence, _Compare>::push;
// using std::priority_queue<_Tp, _Sequence, _Compare>::empty;
// };
// forward reference
class IdbCompare;
class OrderByRow;
@ -484,7 +509,7 @@ class IdbOrderBy : public IdbCompare
};
using DistinctMap_t = std::unordered_set<rowgroup::Row::Pointer, Hasher, Eq,
allocators::CountingAllocator<rowgroup::Row::Pointer>>;
utils::STLPoolAllocator<rowgroup::Row::Pointer>>;
boost::scoped_ptr<DistinctMap_t> fDistinctMap;
rowgroup::Row row1, row2; // scratch space for Hasher & Eq