This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Improve Telnetlib's throughput
Type: resource usage Stage: patch review
Components: Library (Lib) Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: JelleZijlstra, martin_kirch, terry.reedy
Priority: normal Keywords: patch

Created on 2022-02-13 20:17 by martin_kirch, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 31449 open martin_kirch, 2022-02-20 15:04
Messages (3)
msg413195 - (view) Author: Martin Kirchgessner (martin_kirch) * Date: 2022-02-13 20:17
While using `telnetlib` I sometimes received unusually "large" messages (around 1Mb) from another process on the same machine, and was surprised `read_until` took more than a second. After instrumenting I discovered such messages were received at roughly 500kbyte/s.

I think this low throughput comes from two implementation details:

 - `Telnet.fill_rawq` is calling `self.sock.recv(50)`, whereas 4096 is now recommended
 - the `Telnet.process_rawq` method is transferring from raw queue to cooked queue by appending byte per byte.

For the latter, transferring by slices looks much faster (I'm measuring at least 5x). I'm preparing a PR.
msg413206 - (view) Author: Jelle Zijlstra (JelleZijlstra) * (Python committer) Date: 2022-02-14 01:47
Note that telnetlib is being proposed for deprecation in PEP 594. You may be better off using a third-party telnet implementation; the PEP lists https://pypi.org/project/telnetlib3/ and https://pypi.org/project/Exscript/.
msg413509 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2022-02-18 20:15
Even if deprecated, it will be around for at least 2 versions.  A patch now might be worthwhile, but I don't know who would review it.
History
Date User Action Args
2022-04-11 14:59:56adminsetgithub: 90896
2022-02-20 15:04:10martin_kirchsetkeywords: + patch
stage: patch review
pull_requests: + pull_request29577
2022-02-18 20:15:37terry.reedysetnosy: + terry.reedy
messages: + msg413509
2022-02-14 01:47:31JelleZijlstrasetnosy: + JelleZijlstra
messages: + msg413206
2022-02-13 20:17:40martin_kirchcreate