| Summary: | Very high CPU load when entering a number in C++ syntax | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-syntax-highlighting | Reporter: | Andrey Kozlovskiy <akozlovskiy119> |
| Component: | syntax | Assignee: | Nibaldo G. <nibgonz> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | nibgonz, walter.von.entferndt |
| Priority: | NOR | ||
| Version First Reported In: | 5.71.0 | ||
| Target Milestone: | --- | ||
| Platform: | Neon | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | 5.73.0 | |
| Sentry Crash Report: | |||
| Attachments: | Kwrite: hold '1' key CPU load - Normal vs C++ | ||
In the ISO C++ highlighter (isocpp.xml), to detect a number, many context switches occur (there are 4-5 context switches) and there are many RegExpr rules; since suffixes, number types and invalid characters are highlighted. This may explain the high CPU usage. I did tests on "isocpp.xml": in the "Number" context there is a RegExpr rule with a very large regular expression to detect float numbers. This is responsible for slowing down aand using high CPU by writing numbers in C++/ISO C++ A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/10 |
Created attachment 129778 [details] Kwrite: hold '1' key CPU load - Normal vs C++ When I hold a number key to enter some long number in C++, kwrite/kate starts to lag and one of the CPU cores immediately loads up to 100%. Problem is specific to C++/ISO C++ syntax. C, Rust, Java, JavaScript, for example, are not affected. See attached video for example.