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

CPP: emplace_back() replaces many push_back()...to improve performance #14610

Conversation

nonwill
Copy link
Contributor

@nonwill nonwill commented Feb 2, 2025

尽可能的减少临时变量的构造以提高效率:
std::vector: 使用 emplace_back 替换 push_back, 传参满足条件的使用 std::move 或 std::forward 特性
个别函数的参数:不改变值时由传值改为传参引

@CLAassistant
Copy link

CLAassistant commented Feb 2, 2025

CLA assistant check
All committers have signed the CLA.

@GreatV
Copy link
Collaborator

GreatV commented Feb 2, 2025

please fix codestyle

@nonwill nonwill force-pushed the CPP__emplace_back()_replaces_many_push_back() branch from 7d0b5d0 to fab4e68 Compare February 3, 2025 05:01
@GreatV
Copy link
Collaborator

GreatV commented Feb 3, 2025

LGTM

@GreatV GreatV merged commit 42a3c77 into PaddlePaddle:main Feb 3, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants