You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +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:
@ -173,14 +173,7 @@ void StringStore::serialize(ByteStream& bs) const
|
||||
bs.append(mc->data, mc->currentSize);
|
||||
}
|
||||
|
||||
bs << (uint64_t) longStrings.size();
|
||||
|
||||
for (i = 0; i < longStrings.size(); i++)
|
||||
{
|
||||
mc = (MemChunk*) longStrings[i].get();
|
||||
bs << (uint64_t) mc->currentSize;
|
||||
bs.append(mc->data, mc->currentSize);
|
||||
}
|
||||
bs.setLongStrings(longStrings);
|
||||
}
|
||||
|
||||
void StringStore::deserialize(ByteStream& bs)
|
||||
@ -211,20 +204,7 @@ void StringStore::deserialize(ByteStream& bs)
|
||||
bs.advance(size);
|
||||
}
|
||||
|
||||
bs >> count;
|
||||
longStrings.resize(count);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
bs >> size;
|
||||
buf = bs.buf();
|
||||
longStrings[i].reset(new uint8_t[size + sizeof(MemChunk)]);
|
||||
mc = (MemChunk*) longStrings[i].get();
|
||||
mc->capacity = mc->currentSize = size;
|
||||
memcpy(mc->data, buf, size);
|
||||
bs.advance(size);
|
||||
}
|
||||
|
||||
longStrings = bs.getLongStrings();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -175,13 +175,6 @@ public:
|
||||
return fUseStoreStringMutex;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string empty_str;
|
||||
|
||||
StringStore(const StringStore&);
|
||||
StringStore& operator=(const StringStore&);
|
||||
static const uint32_t CHUNK_SIZE = 64 * 1024; // allocators like powers of 2
|
||||
|
||||
// This is an overlay b/c the underlying data needs to be any size,
|
||||
// and alloc'd in one chunk. data can't be a separate dynamic chunk.
|
||||
struct MemChunk
|
||||
@ -191,7 +184,14 @@ private:
|
||||
uint8_t data[];
|
||||
};
|
||||
|
||||
std::vector<boost::shared_array<uint8_t> > mem;
|
||||
private:
|
||||
std::string empty_str;
|
||||
|
||||
StringStore(const StringStore&);
|
||||
StringStore& operator=(const StringStore&);
|
||||
static constexpr const uint32_t CHUNK_SIZE = 64 * 1024; // allocators like powers of 2
|
||||
|
||||
std::vector<boost::shared_array<uint8_t>> mem;
|
||||
|
||||
// To store strings > 64KB (BLOB/TEXT)
|
||||
std::vector<boost::shared_array<uint8_t> > longStrings;
|
||||
|
Reference in New Issue
Block a user