[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: GODRIVER-2542 optimize objectid hex func (#1062)

Co-authored-by: Qingyang Hu <103950869+qingyang-hu@users.noreply.github.com>
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/e9e48b2605fb9ac7de31ad9003c4b34ac9405ce1

Generated at Thu Feb 08 08:38:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.