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

Go: TDserializer is not resource pool friendly

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.14.0
    • Go - Library
    • 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

        Issue Links

          Activity

            People

              Unassigned Unassigned
              fishywang Yuxuan Wang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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