[ 
https://issues.apache.org/jira/browse/THRIFT-5069?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17018163#comment-17018163
 ] 

Duru Can Celasun commented on THRIFT-5069:
------------------------------------------

[~fishywang] it could be useful, depends on what exactly you have in mind. Is 
it just a wrapper around sync.Pool?

> Go: TDserializer is not resource pool friendly
> ----------------------------------------------
>
>                 Key: THRIFT-5069
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5069
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Go - Library
>            Reporter: Yuxuan Wang
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently TSerializer is resource pool friendly (see 
> [here|https://github.com/reddit/baseplate.go/blob/7b73f185eacd319a018df85d683fb2c29b50e2a9/events/events.go#L105-L111]
>  for an example), but TDeserializer is not. When putting a TDeserializer back 
> into resource pool, some extra works need to be done:
> {code:go}
> defer func() {
>       deserializer.Transport.(*thrift.TMemoryBuffer).Reset()
>       deserializerPool.Put(deserializer)
> }()
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to