wangbo commented on code in PR #8967:
URL: https://github.com/apache/incubator-doris/pull/8967#discussion_r848353898
##########
be/src/vec/columns/column_vector.h:
##########
@@ -168,18 +168,16 @@ class ColumnVector final : public
COWHelper<ColumnVectorHelper, ColumnVector<T>>
}
void insert_date_column(const char* data_ptr, size_t num) {
- size_t value_size = sizeof(uint24_t);
+ size_t input_value_size = sizeof(uint24_t);
+
for (int i = 0; i < num; i++) {
- const char* cur_ptr = data_ptr + value_size * i;
- uint64_t value = 0;
- value = *(unsigned char*)(cur_ptr + 2);
- value <<= 8;
- value |= *(unsigned char*)(cur_ptr + 1);
- value <<= 8;
- value |= *(unsigned char*)(cur_ptr);
- vectorized::VecDateTimeValue date;
- date.from_olap_date(value);
- this->insert_data(reinterpret_cast<char*>(&date), 0);
+ uint64_t val = 0;
+ memcpy((char*)(&val), data_ptr, input_value_size);
+ data_ptr += input_value_size;
+
+ VecDateTimeValue date;
Review Comment:
```
q1
- OutputColumnTime: 90.720ms
q2
- OutputColumnTime: 286.477ms
q3
- PredColumnReadTime: 6s827ms
```
I did test after move it out of loop.
There is no noticeable performance change.
I guess the cost of allocate a Object like ```VecDateTimeValue``` on stack
is similar to allocate a int64.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]