Skip to content

Avoid O(n^2) copying in Channel.sendall/sendall_stderr - #2678

Open
SongLiyang2000 wants to merge 2 commits into
paramiko:mainfrom
SongLiyang2000:main
Open

SongLiyang2000 wants to merge 2 commits into
paramiko:mainfrom
SongLiyang2000:main

Conversation

@SongLiyang2000

@SongLiyang2000 SongLiyang2000 commented Aug 26, 2026 •

Copy link
Copy Markdown

Fixes #2659
(GH #2659) sendall repeatedly did s = s[sent:], copying the entire remaining buffer each time send() could only push a small chunk (e.g. tiny remote flow-control windows). Advance a memoryview instead, which slices in O(1).

(GH paramiko#2659) sendall repeatedly did s = s[sent:], copying the entire remaining buffer each time send() could only push a small chunk (e.g. tiny remote flow-control windows). Advance a memoryview instead, which slices in O(1).
Wrap the repr() assertion string across lines to fit the project's
79-char line length limit, which the CircleCI 'Lint' job enforces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - O(n²) behavior in Channel.sendall() with tiny remote flow-control windows

2 participants