Skip to content

Commit 5969f18

Browse files
committed
Bug#36805260: Unnecessary copying in StoreLinkedImmutableStringFromTableBuffers()
StoreLinkedImmutableStringFromTableBuffers() has a TableCollection parameter which is passed by value. TableCollection is a relatively big object, and copying it may also require allocating memory on the heap, so it would be good to avoid the copying. Pass the TableCollection as a constant reference instead. Change-Id: Ib6a34aa4d7190c34249ff70555c87b0a82efe01a (cherry picked from commit fbfa4e117f2aa88e686a661eb01a6c144098f176)
1 parent 8f89523 commit 5969f18

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

sql/iterators/hash_join_buffer.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@
4646
using pack_rows::TableCollection;
4747

4848
LinkedImmutableString StoreLinkedImmutableStringFromTableBuffers(
49-
MEM_ROOT *mem_root, MEM_ROOT *overflow_mem_root, TableCollection tables,
50-
LinkedImmutableString next_ptr, size_t row_size_upper_bound, bool *full) {
49+
MEM_ROOT *mem_root, MEM_ROOT *overflow_mem_root,
50+
const TableCollection &tables, LinkedImmutableString next_ptr,
51+
size_t row_size_upper_bound, bool *full) {
5152
if (tables.has_blob_column()) {
5253
// The row size upper bound can have changed.
5354
row_size_upper_bound = ComputeRowSizeUpperBound(tables);

sql/iterators/hash_join_buffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ class HashJoinRowBuffer {
219219
/// External interface to the corresponding member in HashJoinRowBuffer
220220
LinkedImmutableString StoreLinkedImmutableStringFromTableBuffers(
221221
MEM_ROOT *mem_root, MEM_ROOT *overflow_mem_root,
222-
pack_rows::TableCollection tables, LinkedImmutableString next_ptr,
222+
const pack_rows::TableCollection &tables, LinkedImmutableString next_ptr,
223223
size_t row_size_upper_bound, bool *full);
224224

225225
#endif // SQL_ITERATORS_HASH_JOIN_BUFFER_H_

0 commit comments

Comments
 (0)