You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/10/24 12:51:23 UTC

[GitHub] [pulsar-client-cpp] tongsucn opened a new issue, #65: [Improve] Add interfaces in `class Message` to avoid unnecessary memory copy.

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: commits-unsubscribe@pulsar.apache.org.apache.org

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


[GitHub] [pulsar-client-cpp] tongsucn commented on issue #65: [Improve] Add interfaces in `class Message` to avoid unnecessary memory copy.

Posted by GitBox <gi...@apache.org>.
tongsucn commented on issue #65:
URL: https://github.com/apache/pulsar-client-cpp/issues/65#issuecomment-1319687263

   Closed, see more in #66 


-- 
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: commits-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar-client-cpp] tongsucn closed issue #65: [Improve] Add interfaces in `class Message` to avoid unnecessary memory copy.

Posted by GitBox <gi...@apache.org>.
tongsucn closed issue #65: [Improve] Add interfaces in `class Message` to avoid unnecessary memory copy.
URL: https://github.com/apache/pulsar-client-cpp/issues/65


-- 
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: commits-unsubscribe@pulsar.apache.org

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