Repository navigation
[vectorized](improving) (exec) optimize VDataStreamSender's send() performance #7747 - #7751
Conversation
| auto& dst = _columns[i]; | ||
| auto& src = *src_columns_with_schema[i].column.get(); | ||
| for (const int* row = row_begin; row != row_end; ++row) { | ||
| dst->insert_from(src, *row); |
There was a problem hiding this comment.
here will be virtual function call. so we should implement a function in column.
There was a problem hiding this comment.
yes, that 's what i will todo next
Since DataStreamSender is fast, the complete query time may not reflect the PR difference. |
please test for the recently commit, thanks! |
|
new test:
note: hash join |
|
test sql: before prTotal: 15s147ms after prTotal: 13s414ms |
|
|
||
| void insert_indices_from(const IColumn& src, const int* indices_begin, const int* indices_end) override { | ||
| for (auto x = indices_begin; x != indices_end; ++x) { | ||
| Self::insert_from(src, *x); |
There was a problem hiding this comment.
same to the column_vector
|
|
||
| template <typename T> | ||
| void ColumnVector<T>::insert_indices_from(const IColumn& src, const int* indices_begin, const int* indices_end) { | ||
| const Self& src_vec = assert_cast<const Self&>(src); |
There was a problem hiding this comment.
use push_back_without_reserve
| } | ||
|
|
||
| void ColumnNullable::insert_indices_from(const IColumn& src, const int* indices_begin, const int* indices_end) { | ||
| for (auto x = indices_begin; x != indices_end; ++x) { |
There was a problem hiding this comment.
which will cause to many virtural function call, refactor it
| } | ||
|
|
||
| // channel2rows' subscript means channel id | ||
| std::vector<vectorized::UInt64> hash_vals(rows); |
| // vectorized caculate hash val | ||
| int rows = block->rows(); | ||
| // for each row, we have a hash_val | ||
| std::vector<size_t> hash_vals(rows); |
|
|
||
| template <typename Channels, typename HashVals> | ||
| Status VDataStreamSender::channel_add_rows(Channels& channels, int num_channels, const HashVals& hash_vals, int rows, Block* block) { | ||
| std::vector<int> channel2rows[num_channels]; |
There was a problem hiding this comment.
same to the up, we should reuse the mem
There was a problem hiding this comment.
channel2rows is used for aggregate rows for channels, it's a temporary data served for the function of channel_add_rows, it's not used in other member functions, it's not has getter/setter, it's not visiable to outer, so i don't think make it as member data is a good idea.
for performance, if you can prove it with rewriting code, please tell me
Proposed changes
gather channel's rows, and then send together
handle each column's different rows at a time is good for improving cache hit
comparing test data, wait @zenoyang to provide
Issue Number: close #xxx
Problem Summary:
Describe the overview of changes.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...