Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2023

Optimizing CompressorNoOp in Connection.CompressWireMessage()

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.10.0
    • Affects Version/s: 1.5.2
    • Component/s: None
    • None

      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.

       

       

            Assignee:
            qingyang.hu@mongodb.com Qingyang Hu
            Reporter:
            tim.fogarty@mongodb.com Tim Fogarty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: