[SERVER-81571] Reconsider stable sort in sorter.cpp Created: 29/Sep/23 Updated: 06/Feb/24 |
|
| Status: | Blocked |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Jordi Olivares Provencio | Assignee: | Brad Cater |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | former-storex-namer, storex-ranked | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||
| Assigned Teams: |
Storage Execution
|
||||||||||||||||||||||||||||||||||||
| Sprint: | Execution Team 2024-01-08, Execution Team 2024-01-22, Execution Team 2024-02-05, Repl 2024-02-19 | ||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||
| Description |
|
During analysis of Additionally, we found that the NoLimit sorter uses a deque instead of a normal vector with a reserved capacity that would offer better memory locality. A rough patch that implemented the changes mentioned here yielded a very significant improvement in index builds. |
| Comments |
| Comment by Jordi Olivares Provencio [ 13/Oct/23 ] |
|
Note that the historic reason for choosing deque goes back to pre-C++11 days. In that time there was no move optimization present and the BSONObj class used in some values would have to perform a lot of refcount inc/dec when doing vector growth due to the copies. This shouldn't be an issue nowadays as all users of the NoLimit sorter can use the move optimisation since they have both destructor and move construct as noexcept. Note also that since |