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

MCOL-4810 Redundant copying and wasting memory in PrimProc

This patch eliminates a copying `long string`s into the bytestream.
This commit is contained in:
Denis Khalikov
2021-08-11 15:07:19 +03:00
parent 923bbf4033
commit 7bda598fbf
6 changed files with 155 additions and 176 deletions

View File

@ -59,6 +59,8 @@ void ByteStream::doCopy(const ByteStream& rhs)
memcpy(fBuf + ISSOverhead, rhs.fCurOutPtr, rlen);
fCurInPtr = fBuf + ISSOverhead + rlen;
fCurOutPtr = fBuf + ISSOverhead;
// Copy `longStrings` as well.
longStrings = rhs.longStrings;
}
ByteStream::ByteStream(const ByteStream& rhs) :
@ -87,6 +89,8 @@ ByteStream& ByteStream::operator=(const ByteStream& rhs)
delete [] fBuf;
fBuf = fCurInPtr = fCurOutPtr = 0;
fMaxLen = 0;
// Clear `longStrings`.
longStrings.clear();
}
}
@ -152,6 +156,18 @@ void ByteStream::growBuf(uint32_t toSize)
}
}
std::vector<boost::shared_array<uint8_t>>& ByteStream::getLongStrings() { return longStrings; }
const std::vector<boost::shared_array<uint8_t>>& ByteStream::getLongStrings() const
{
return longStrings;
}
void ByteStream::setLongStrings(const std::vector<boost::shared_array<uint8_t>>& other)
{
longStrings = other;
}
ByteStream& ByteStream::operator<<(const int8_t b)
{
if (fBuf == 0 || (fCurInPtr - fBuf + 1U > fMaxLen + ISSOverhead))