Github user StephanEwen commented on the pull request:

    https://github.com/apache/incubator-flink/pull/254#issuecomment-66321956
  
    This will take a bit to double-check. All in all: nice code!
    
    You serialize Strings in most places by writing their byte length and their 
bytes: `out.writeInt(msg.getBytes().length);` and 
`out.writeBytes(msg.getBytes());`. In most other places, we used either 
`out.writeUtf8()`, or preferable `StringUtils.writeNullableString()` or 
`StingValue.writeString()`. Also, the above code frequently goes through the 
charset encoding code paths multiple, which is a bit unnecessary.
    
    The encoding logic in the `NettyMessage` does a few unnecessary or at least 
clumsy steps. The reason seems to be that every message must compute its exact 
size before actually putting its contents into the netty buffer. We can 
simplify that by allowing the *write()* call to allocate and return the target 
buffer by itself. That way, we can also implement code that does not really 
copy data into netty buffers, but only wraps existing NIO buffers.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to