[GODRIVER-2023] Optimizing CompressorNoOp in Connection.CompressWireMessage() Created: 23/May/21  Updated: 28/Oct/23  Resolved: 22/Jun/22

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: 1.5.2
Fix Version/s: 1.10.0

Type: Improvement Priority: Unknown
Reporter: Tim Fogarty Assignee: Qingyang Hu
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: Reduce Allocations
Quarter: FY23Q2, FY23Q3

 Description   

In Connection.CompressWireMessage() we currently copy src into dst when using no compression:

if c.connection.compressor == wiremessage.CompressorNoOp {
    return append(dst, src...), nil
} 

Can we just set dst = src? I made this change and tested with mongorestore and it seemed to work fine, but I'm wondering if the underlying array can be mutated through dst at a later point which would cause problems for code still using src.

 

 



 Comments   
Comment by Qingyang Hu [ 22/Jun/22 ]

Fixed in GODRIVER-2259

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