micro icon indicating copy to clipboard operation
micro copied to clipboard

Poor performance on string highlighting

Open SollyBunny opened this issue 1 year ago • 5 comments

Description of the problem or steps to reproduce

In a large text document placing a single quote will freeze micro to the point where I end up just killing it. ):

Specifications

Version: 0.0.0-unknown Commit hash: 0859f4aa Compiled on June 09, 2023 OS: Arch Linux x64 Terminal: Kitty

SollyBunny avatar Jun 11 '23 14:06 SollyBunny

Can you please provide a sample document? I will have a look into it, if things can be improved.

JoeKar avatar Jun 11 '23 14:06 JoeKar

While trying to get something to work with strings I got it to work with the script tag and it crashes as it attempts to highlight the js This death by recursion is probably because of the highlighter now using a recursive regex. The error is attatched since it's quiet long error.log

Steps to reproduce:

  1. download sample.md file (doesn't let me attach html files)
  2. rename it to *.html
  3. open it in micro
  4. insert
  5. death

The original file I experiences the hang on can't be shared since it contains personal information

SollyBunny avatar Jun 11 '23 15:06 SollyBunny

@SollyBunny: Please give some feedback how the general behavior is with #2840 regarding the performance.

JoeKar avatar Jun 13 '23 19:06 JoeKar

Is the same

SollyBunny avatar Jun 15 '23 16:06 SollyBunny

I took this issue and currently try to improve the highlighting performance. The first result is a ~50% faster highlighting, but it's still horrible slow in case a lot of (nested) regions are placed in a very long line. Further improvements need some larger rework in the highlighting code, which isn't really optimized so far. But this will take some more time, since changes there easily brake the whole feature. :wink:

JoeKar avatar Jan 20 '24 19:01 JoeKar