Mryange commented on code in PR #55719:
URL: https://github.com/apache/doris/pull/55719#discussion_r2348061741


##########
be/src/vec/runtime/vdata_stream_mgr.cpp:
##########
@@ -148,8 +148,7 @@ Status VDataStreamMgr::transmit_block(const 
PTransmitDataParams* request,
     bool eos = request->eos();
     if (!request->blocks().empty()) {
         for (int i = 0; i < request->blocks_size(); i++) {
-            std::unique_ptr<PBlock> pblock_ptr = std::make_unique<PBlock>();
-            pblock_ptr->Swap(const_cast<PBlock*>(&request->blocks(i)));
+            std::unique_ptr<const PBlock> pblock_ptr = 
std::make_unique<PBlock>(request->blocks(i));

Review Comment:
   这块的const_cast是一个已知问题,为了减少一次copy。
   但是现在这个改法
   `C++
   std::unique_ptr<const PBlock> pblock_ptr = 
std::make_unique<PBlock>(request->blocks(i));
   `
   是会有一次拷贝构造的 https://godbolt.org/z/a64PPEGvv



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to