tongsucn opened a new issue, #65:
URL: https://github.com/apache/pulsar-client-cpp/issues/65

   ## Motivation
   
   Currently `class Message` provides two groups of functions to access the 
message's payload:
   
   1. `Message::getData` and `Message::getLength`.
   2. `getDataAsString`: this is a wrapper of the two above.
   
   The second one performs `std::string`'s construction, which contains 
expensive memory copy. If `class Message` can provide a new function that gives 
payload's ownership to the caller like this:
   
   ```cpp
   // In SharedBuffer.h add new function:
   bool SharedBuffer::pop(std::string &target) {
       // Swap *data_ into target, then reset ptr_, readIdx_ etc.
   }
   
   // Message.cc
   void Message::moveDataIntoString(std::string &data) {
       // Move payload into data via SharedBuffer::pop.
   }
   ```
   
   In high-throughput scenario, these new functions could bring significant 
performance improvement at data consuming.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to