Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove implicit copy due to conversion from cudf::size_type and size_t #10045

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cpp/src/io/orc/aggregate_orc_metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ std::vector<metadata::stripe_source_mapping> aggregate_orc_metadata::select_stri

// Coalesce stripe info at the source file later since that makes downstream processing much
// easier in impl::read
for (const size_t& stripe_idx : user_specified_stripes[src_file_idx]) {
CUDF_EXPECTS(stripe_idx < per_file_metadata[src_file_idx].ff.stripes.size(),
for (const auto& stripe_idx : user_specified_stripes[src_file_idx]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just small nit:

Suggested change
for (const auto& stripe_idx : user_specified_stripes[src_file_idx]) {
for (const auto stripe_idx : user_specified_stripes[src_file_idx]) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ttnghia Can you explain why you're suggesting this change?

Copy link
Contributor

@ttnghia ttnghia Jan 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @bdice for late reply (I didn't see this).
A reference is similar to pointer, which is 64 bits. If you use reference for 32 bits numbers, that's kind of inefficient. Although the compiler can optimize this and generate the same code (for references and without references), it is still logically inefficient.

CUDF_EXPECTS(stripe_idx < static_cast<decltype(stripe_idx)>(
per_file_metadata[src_file_idx].ff.stripes.size()),
"Invalid stripe index");
stripe_infos.push_back(
std::make_pair(&per_file_metadata[src_file_idx].ff.stripes[stripe_idx], nullptr));
Expand Down