prompt-toolkit / prompt-toolkit/python-prompt-toolkit

prompt-toolkit unusable on raspberry pi due to speed issues

Open
#830 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

I think speed has been mentioned several times regarding prompt-toolkit. A quick search turns up these issues: #682 and #516

I developed a small dialog program with prompt-toolkit for an educational IoT project running on a raspberry Pi 3 (running latest raspbian) for python3. That needs some terminal based dialogs running in a web terminal (gritty: https://github.com/cloudcmd/gritty).

While testing it on my PC (Manjaro, i7 Quadcore, 16GB ram) it ran flawlessly without any noticeable lag, however, on the pi it had some really bad performance issus. Startup is about 5s, moving from one button to another takes 2-3 seconds (during the shift from button to button CPU goes up to 100% on a before idle raspberry pi). Mouse seems not to work at all (but maybe that's a speed issue too).
I tried to adjust max_render_postpone_time to 0.5, but it had no measurable effect.
Running the program via ssh in a xfce4-terminal made the mouse work, but had the same slow reaction time when moving from button to button.

I also tried to get pypy3 installed on the pi to see if it accelerates better, but was not successful due to dependencies (maybe should try an arch pi image).

You can also see a definite sluggishness (not as bad as my test) in ipython3 and xonsh.

I tested then several other TUI (mpyscreen, asciimatic, urwid), they were a bit faster but still unbearably slow. However other console gui apps like midnight commander or the tilde text editor run just fine.

With terminal-kit (https://github.com/cronvel/terminal-kit) and a nodejs application the reaction is instantaneous. I would though much rather use python prompt-toolkit.

If anybody knows what to test and accelerate python prompt-toolkit on the Raspberry Pi, I am happy to run the tests to track that down (i would also really like to make ipython3 and xonsh work on this pi environment).

Here are the test scripts:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported lag on the Raspberry Pi using the linked Python script, and compare it with the linked Node.js script and the reported prompt-toolkit behavior in IPython or xonsh. Measure startup, button navigation, mouse handling, CPU usage, and rendering to identify a reproducible bottleneck; done means a documented cause and a verified performance improvement or a focused upstream report.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, python, raspberry-pi
Domain
cli, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.