prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Performance tips?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Thanks for this great library. I am using it in https://github.com/davidbrochart/nbterm, a Jupyter Notebook in the terminal. So far it works great, but I'm not sure I'm using prompt-toolkit right, and maybe I am abusing its flexibility at the cost of a loss in performance.
In nbterm, the complexity of the layout is directly linked to the number of cells in the notebook, and I have seen that it doesn't scale very well. I would have thought that cells not visible on the screen would not matter (because not rendered), but it looks like it does, e.g. if I have 100 cells but only 10 fit on the screen, then it's "as slow as" rendering these 100 cells. Even focusing on a cell gets slow (using up and down arrows), even if the layout doesn't have to be re-rendered.
Maybe I am doing something wrong, or my application is not well structured. So I was wondering, is there any common mistake you know of, that could explain this loss in performance? Or tips that generally help?
Thanks again!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by profiling nbterm's layout, rendering, and focus paths with a notebook containing about 100 cells while only 10 are visible. Compare rendering and up/down-arrow latency, then document a reproducible bottleneck or confirmed usage issue in prompt-toolkit. Done means the performance cause and a concrete direction are established, but the issue does not name files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100