facebookarchive / swift

An annotation-based Java library for creating Thrift serializable types and services.
Apache License 2.0
900 stars 297 forks source link

Avoid unnecessary memcopy during during Async Client calls #161

Closed rshroff closed 6 years ago

rshroff commented 10 years ago

It looks like the async call has majorly 3 steps:

  1. Serialize the method+data into the outputTransport
  2. Copy the data from outputTransport into a new ChannelBuffer
  3. Enqueue the request to nio-client threadpool

By looking at the SocketSendBufferPool class, acquire(), seems like it copies the ChannerBuffer into a “pooled” DirectBuffer if the size is less than 64KB. I was curious to know if we could directly copy the outputTransport data in step 2 to DirectBuffer(we already know the size), or create a new transport on every call to avoid this extra copy??

ghost commented 9 years ago

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.