Open ulno opened 5 years ago
Hi @ulno,
Thanks for pointing this out. As soon as I have time, I'll set up a raspberry to try again. I will have a look at this nodejs library and see how they approach the rendering. The prompt_toolkit rendering is pretty advanced and complex, and that comes with a cost.
If you have time, could you try to use the pypy interpreter for your application? Pypy has just in time compilation (like Node) and possibly this can improve the performance quite a bit.
I was trying to make pypy3 work on the raspberry pi but failed.
pypy2 is still working with prompt-toolkit?
I have also big performance issues with platformio on the pi (so I need to try pypy2 on the pi anyway as platformio only runs with python 2 and give prompt-toolkit a go then).
It does feel a tiny bit faster with pypy2, but moving from button to button still takes over a second (and startup is very slow).
on a side note: platformio runs 50% slower with pypy on the pi
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: