You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celeborn.apache.org by ni...@apache.org on 2025/08/16 04:57:06 UTC

(celeborn) branch branch-0.6 updated: [CELEBORN-2100] Fix performance issue on readToReadOnlyBuffer

This is an automated email from the ASF dual-hosted git repository.

nicholasjiang pushed a commit to branch branch-0.6
in repository https://gitbox.apache.org/repos/asf/celeborn.git


The following commit(s) were added to refs/heads/branch-0.6 by this push:
     new 730524c23 [CELEBORN-2100] Fix performance issue on readToReadOnlyBuffer
730524c23 is described below

commit 730524c234402eabf0c8b685b5184d676c7be7f2
Author: Jray <10...@qq.com>
AuthorDate: Sat Aug 16 12:56:38 2025 +0800

    [CELEBORN-2100] Fix performance issue on readToReadOnlyBuffer
    
    ### What changes were proposed in this pull request?
    Fix performance issue on ReadOnlyByteBuffer::readToReadOnlyBuffer.
    
    ### Why are the changes needed?
    ReadOnlyByteBuffer::readToReadOnlyBuffer now is slow on a long iobuf chain because it used wrong api to clone an iobuf block.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    By compilation and UTs.
    
    Closes #3415 from Jraaay/fix/readToReadOnlyBuffer.
    
    Authored-by: Jray <10...@qq.com>
    Signed-off-by: SteNicholas <pr...@163.com>
    (cherry picked from commit 180a74146c4e4fd462f37faec8c4b17198d10a0f)
    Signed-off-by: SteNicholas <pr...@163.com>
---
 cpp/celeborn/memory/ByteBuffer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpp/celeborn/memory/ByteBuffer.cpp b/cpp/celeborn/memory/ByteBuffer.cpp
index a44ba92bd..e35f662f8 100644
--- a/cpp/celeborn/memory/ByteBuffer.cpp
+++ b/cpp/celeborn/memory/ByteBuffer.cpp
@@ -84,7 +84,7 @@ std::unique_ptr<ReadOnlyByteBuffer> ReadOnlyByteBuffer::readToReadOnlyBuffer(
       break;
     }
     std::unique_ptr<folly::IOBuf> newBlock =
-        std::move(this->cursor_->currentBuffer()->clone());
+        std::move(this->cursor_->currentBuffer()->cloneOne());
     newBlock->pop();
     newBlock->trimStart(this->cursor_->getPositionInCurrentBuffer());
     if (newBlock->length() > len - cnt) {