Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5069

Go: TDserializer is not resource pool friendly

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.14.0
    • Component/s: Go - Library
    • Labels:
      None

      Description

      Currently TSerializer is resource pool friendly (see here for an example), but TDeserializer is not. When putting a TDeserializer back into resource pool, some extra works need to be done:

      defer func() {
      	deserializer.Transport.(*thrift.TMemoryBuffer).Reset()
      	deserializerPool.Put(deserializer)
      }()
      

      If we change the type of TDeserializer.Transport to *TMemoryBuffer, and also call Transport.Reset() at the beginning of Read and ReadString (we already do both in TSerializer), it will make it more resource pool friendly.

      This will be a breaking change, though.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              fishywang Yuxuan Wang

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m

                  Issue deployment