MantisBT - Doomseeker | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0003814 | Doomseeker | [All Projects] Cleanup | public | 2020-06-07 05:20 | 2020-06-07 20:41 |
Reporter | WubTheCaptain | ||||
Assigned To | |||||
Priority | none | Severity | minor | Reproducibility | sometimes |
Status | confirmed | Resolution | open | ||
Platform | OS | OS Version | |||
Product Version | 1.3.1 | ||||
Target Version | Fixed in Version | ||||
Summary | 0003814: Inefficient string concatenation | ||||
Description | operator+ creates temporary strings and unnecessary copies. std::string’s (std::basic_string) class member function append(), and QString::appendmember, calculate the final result without any temporaries. Affects performance. | ||||
Steps To Reproduce | Here's an example:Quote from src/core/irc/ircnetworkadapter.cppvoid IRCNetworkAdapter::setChannelMode(const QString &channel, const QString &nickname, const QString &flag, bool bSet) { /* ... */ QString flagPrefixed; if (bSet) flagPrefixed = "+" + flag.trimmed(); else flagPrefixed = "-" + flag.trimmed(); /* ... */ } There are many more. They're not always easy to search for. $ grep -r '" + "' src/ | wc -l 1 $ grep -r '" + ' src/ | wc -l 98 $ grep -r ' + "' src/ | wc -l 118 Assumed good behavior: $ grep -r "\.append(" src/ | wc -l 72 | ||||
Additional Information | 'https://clang.llvm.org/extra/clang-tidy/checks/performance-inefficient-string-concatenation.html [^]' 'https://www.qt.io/blog/efficient-qstring-concatenation-with-c17-fold-expressions [^]' | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2020-06-07 05:20 | WubTheCaptain | New Issue | |||
2020-06-07 05:20 | WubTheCaptain | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=13133#r13133 | ||
2020-06-07 05:20 | WubTheCaptain | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=13134#r13134 | ||
2020-06-07 05:23 | WubTheCaptain | Note Added: 0021366 | |||
2020-06-07 20:41 | Pol M | Note Added: 0021388 | |||
2020-06-07 20:41 | Pol M | Status | new => confirmed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|