You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/06/24 09:01:05 UTC

[GitHub] [doris] mrhhsg commented on a diff in pull request #10386: [improvement]Use std::iota to set values of _block_rowids in SegmentIterator::_read_columns_by_index

mrhhsg commented on code in PR #10386:
URL: https://github.com/apache/doris/pull/10386#discussion_r905868074


##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -872,9 +872,11 @@ Status SegmentIterator::_read_columns_by_index(uint32_t nrows_read_limit, uint32
                 _read_columns(_first_read_column_ids, _current_return_columns, rows_to_read));
         _cur_rowid += rows_to_read;
         if (set_block_rowid) {
-            for (uint32_t rid = range_from; rid < range_to; rid++) {
-                _block_rowids[nrows_read++] = rid;
-            }
+            // Here use std::iota is better performance than for-loop, maybe for-loop is not vectorized

Review Comment:
   There are two reasons why this loop can not be vectorized:
   1. `nrows_read` is reference
   2. `nrows_read` is unsigned



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org