[GODRIVER-2542] Optimize ObjectID.Hex() Created: 08/Sep/22 Updated: 28/Oct/23 Resolved: 16/Sep/22 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.11.0 |
| Type: | Improvement | Priority: | Unknown |
| Reporter: | Qingyang Hu | Assignee: | Qingyang Hu |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Documentation Changes: | Not Needed |
| Description |
|
EncodeToString internally creates a slice not an array and thus makes unnecessary allocation. Since we know exactly the size of the resulting hex, we can optimize the function by using an array. |
| Comments |
| Comment by Githook User [ 16/Sep/22 ] |
|
Author: {'name': 'Ivan Sopov', 'email': 'isopov@joom.com', 'username': 'isopov'}Message: Co-authored-by: Qingyang Hu <103950869+qingyang-hu@users.noreply.github.com> |