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

msg/async: use auto iterator having more simple code and good performance #16524

Merged
merged 1 commit into from Jul 24, 2017

Conversation

Projects
None yet
2 participants
@dingdangzhang
Contributor

dingdangzhang commented Jul 24, 2017

Use auto iterator having more simple code and good performance.

Signed-off-by: dingdangzhang boqian.zy@alibaba-inc.com

std::list<buffer::ptr>::const_iterator pb;
for (pb = bl.buffers().begin(); pb != bl.buffers().end(); ++pb) {
outcoming_bl.append((char*)pb->c_str(), pb->length());
for (auto &pb:bl.buffers()) {

This comment has been minimized.

@joscollin

joscollin Jul 24, 2017

Member
  1. Use const
  2. Leave a space before and after :

This comment has been minimized.

@joscollin

joscollin Jul 24, 2017

Member

@dingdangzhang I don't think this would improve significant performance though. It is just a clean up.

This comment has been minimized.

@dingdangzhang

dingdangzhang Jul 24, 2017

Contributor

@joscollin because there is a temp object constructor happening per loop if write before. but there is only one time invoking bl.buffers().end() for the range-base for statement. so I think it's good for code and performance especially IO path. thanks.

@joscollin joscollin added the cleanup label Jul 24, 2017

use auto iterator having more simple code and good performence
Signed-off-by: dingdangzhang <boqian.zy@alibaba-inc.com>

@joscollin joscollin changed the title from use auto iterator having more simple code and good performence to msg/async: use auto iterator having more simple code and good performance Jul 24, 2017

@joscollin joscollin merged commit dbb48ca into ceph:master Jul 24, 2017

3 of 4 checks passed

make check (arm64) running make check
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment