[
https://issues.apache.org/jira/browse/THRIFT-2021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13696008#comment-13696008
]
Ben Craig commented on THRIFT-2021:
-----------------------------------
For large strings, the heap is being used in both cases. std::string generally
uses the heap, and only small strings go on the stack.
If there is a heap overflow issue, then both the old and new code are equally
vulnerable, as both call this->trans->readAll into a buffer that could be
exactly "size" bytes. I don't think there's a heap overflow in either set of
code, but if there were, then the new code shouldn't make it any worse.
> Improve large binary protocol string performance
> ------------------------------------------------
>
> Key: THRIFT-2021
> URL: https://issues.apache.org/jira/browse/THRIFT-2021
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Library
> Affects Versions: 0.9
> Reporter: Ben Craig
> Fix For: 1.0
>
> Attachments: fast_binary_strings.patch
>
>
> Currently, TBinaryProtocol reads into a temporary buffer, then copies the
> results into the resulting std::string. For large strings (like a megabyte),
> the copy can be a performance issue.
> The attached patch reads directly into the std::string instead.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira