SerializationArray: Use reserve() over resize()

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2022-01-28 19:41:20 +03:00
parent aff7bc3e31
commit 06318ebed5

View File

@ -37,10 +37,11 @@ void SerializationArray::deserializeBinary(Field & field, ReadBuffer & istr) con
{
size_t size;
readVarUInt(size, istr);
field = Array(size);
field = Array();
Array & arr = get<Array &>(field);
arr.reserve(size);
for (size_t i = 0; i < size; ++i)
nested->deserializeBinary(arr[i], istr);
nested->deserializeBinary(arr.emplace_back(), istr);
}