Hi,

I noticed TCompactProtocol is using std::string::assign(). TBinaryProtocol assigns to the passed-in str as an lvalue.

This may make only a minor difference -- although GNU libstdc++ refcounts std::basic_string's internal representation, which might save a copy on the input path.

cheers,
BMS
Index: TBinaryProtocol.cpp
===================================================================
--- TBinaryProtocol.cpp (revision 883543)
+++ TBinaryProtocol.cpp (working copy)
@@ -387,7 +387,7 @@
     string_buf_size_ = size;
   }
   trans_->readAll(string_buf_, size);
-  str = string((char*)string_buf_, size);
+  str.assign((char*)string_buf_, size);
   return (uint32_t)size;
 }
 

Reply via email to