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.
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
Fixed in: https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/10