matplotlib / matplotlib/matplotlib
[MNT]: mathtext.MathTextParser is slow
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 23.2k
- Forks
- 8.5k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 66
Description
### Summary
The mathtext.MathTextParser is a performance bottleneck.
I profiled my interactive app that uses PyQt and matplotlib to draw complex plots with very little text and yet significant time (20 %) is spend in the mathtext.MathTextParser. See
[profile_graph.pdf](https://github.com/matplotlib/matplotlib/files/6963037/profile_graph.pdf)
### Proposed fix
The parser is using pyparsing internally and could potentially be speed up by switching to [lark](https://github.com/lark-parser/lark).
Contributor guide
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 with matplotlib's mathtext.MathTextParser and reproduce the reported profiling scenario using complex plots with little text. Compare the parser's current pyparsing behavior with the proposed lark approach, then measure whether parsing time improves without changing rendered output. The profile_graph.pdf provides the reported performance baseline.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100