[SERVER-66053] Use StringSet instead of std::set in getModifiedPaths Created: 28/Apr/22 Updated: 29/Oct/23 Resolved: 14/Jul/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.1.0-rc0 |
| Type: | Task | Priority: | Minor - P4 |
| Reporter: | David Percy | Assignee: | Matt Olma |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | greenerbuild | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Optimization
|
| Backwards Compatibility: | Fully Compatible |
| Sprint: | QO 2023-07-10, QO 2023-07-24 |
| Participants: |
| Description |
|
If we change `std::set<std::string> paths` () to `StringSet paths`, there are a couple benefits:
However this assumes we don't care about the order of elements in this set. It looks like we are iterating over this set in a few places, which may or may not mean the order matters. For example if we only union/intersect this with other sets, and check membership, then order doesn't matter. Whoever takes this will need to check whether the order matters or not. |
| Comments |
| Comment by Githook User [ 14/Jul/23 ] |
|
Author: {'name': 'mattsimply', 'email': '67564577+mattsimply@users.noreply.github.com', 'username': 'mattsimply'}Message: |
| Comment by David Percy [ 10/Jul/23 ] |
|
matt.olma@mongodb.com found some uses that rely on the order, so I guess we can't switch to a hash table. But we can still make sure it's using heterogenous lookup. We're already using a custom comparator, so I think we can just change the comparator to take 'StringData' instead of 'const std::string&'. Then the comparator will work with any combination of std::string / StringData arguments, and so inserts and queries on the map won't make any temporary strings. |