jonahaapala opened a new pull request, #3173:
URL: https://github.com/apache/thrift/pull/3173

   I noticed that when partial deserialization was added a new method 
`readFieldBeginData()` was added to elide the TField object creation. However, 
only the **TBinaryProtocol** takes advantage of this. This PR updates 
**TCompactProtocol** to do the same.
   
   Also, while using the **TProtocol** helper method `readMap()` that takes a 
**ReadMapEntryCallback** I found myself wishing I could passing a separate 
keyCallback and valueCallback so my calling code can use method 
references/lambdas.
   
   Another minor tweak in this area was the default `mapCreator` for maps and 
sets. In later versions of Java they added the `HashMap.newHashMap()` factory 
method which will size the table to prevent resizing when given an initial 
capacity that won't be exceeded. I don't know of an equivalent for HashSet, 
though the HashSet constructor that takes in a Collection also performs this 
optimization. I have added them here for convenience. I have noticed in the 
past that the Java thrift compiler initially sizes maps to 2x their size likely 
for this reason, so this is like an analogue to that. Perhaps the compiler 
should also be doing this, but I suspect it's of minor consequence either way.
   
   While trying to utilize the **TProtocolDecorator** I was sad that none of 
the `skip*()` methods were delegated to. I mostly wanted `skipBinary()`, but 
added them all for completeness. Again, looks like these were added for partial 
deserialization so I assume it was just missed. I added a few more overrides to 
it as well to really treat it as a delegating wrapper.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@thrift.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to