[SERVER-68988] Coverity analysis defect 122770: AUTO_CAUSES_COPY Created: 19/Aug/22 Updated: 29/Oct/23 Resolved: 14/Mar/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.0.0-rc0 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Coverity Collector User | Assignee: | Amr Elhelw |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | coverity, neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Assigned Teams: |
Query Optimization
|
| Backwards Compatibility: | Fully Compatible |
| Sprint: | QE 2023-03-06, QE 2023-03-20 |
| Participants: |
| Description |
|
AUTO_CAUSES_COPY Unnecessary object copies can affect performance. Using the auto keyword without an & causes a copy. |
| Comments |
| Comment by Githook User [ 14/Mar/23 ] |
|
Author: {'name': 'Amr Elhelw', 'email': 'amr.elhelw@mongodb.com', 'username': 'aelhelw'}Message: |
| Comment by Kyle Suarez [ 02/Sep/22 ] |
|
After taking a closer look, we can omit doing CID 122770: we are iterating over BSONElements, and it's efficient to copy them. (They are 16 bytes and therefore are passed via register in all architectures we care about.) I have deleted the screenshot with this CID. It would still be nice to do CID 123199 as I think we could benefit from not coping the GetNextResult. |
| Comment by Ana Meza [ 02/Sep/22 ] |
|
Not urgent - but please do if you have time |
| Comment by Kyle Suarez [ 19/Aug/22 ] |
|
There were multiple AUTO_CAUSES_COPY violations filed so whoever takes this, please sweep through the file. |