Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

SyntaxEdit very slow for large files with CSS syntax highlighting

I don't normally edit such large CSS files but I was doing some testing and came across a problem where the editor seems to get very slow or bogged down when CSS syntax highlighting is enabled.

1. See attached file and load into SyntaxEdit with CSS syntax highlighting.
2. Go to line 18904 - "  --tw-ring-color: rgba(0, 0, 0);"
3. Go to the end of that line and just start typing " this is a test"
4. I think the problem can also be reproduce in similar ways on other lines.
5. The problem goes away when syntax highlighting is turned off.

Is it possible to fix this issue so the editor is usable with large CSS files? Perhaps this problem also extends to other large files (though I haven't tested)?

zip
zip
big-file.zip
273K
Tagged:

Comments

  • 8 Comments sorted by Votes Date Added
  • Hi,

    Unfortunately, I cannot reproduce this issue. Yes, when you scroll down big file *first time*, there can be some lags, less than a fraction of a second (given your file has 150000 lines).

    Otherwise, I can easily edit any line in the text.
  • That's interesting. The delay is much more than a fraction of a second. I wonder why you cannot reproduce it.

    Are you able to install a trial version of my software and see if you can reproduce it there? It might shed some light on what is happening.

  • I can confirm delays in your application. 
    Btw, you can also check the issue using provided MegaDemo demo project (in which it not reproducible).
  • I tried to reproduce in the MegaDemo and could not. I will do some more investigation.
  • edited March 12 Posts: 151Vote Up0Vote Down
    OK, I spent a bit more time trying to figure this out.

    It seems to be related to Addict Spell checker, even though I turned Live Spelling off.

    If I do not add the SyntaxEdit objects as a control for AddictSpell to spell check, the problem does not appear.

    Also, if I turn SyntaxEdit's syntax parsing/highlighting off, the problem does not occur either.

    So it seems to have something to do with both LMD's syntax parsing and the Addict spell checker.

    Also, when I type just alphabet and numeric characters, the problem does not occur. It occurs when I type a space character or a period, which would seem to indicate that a spell check is being triggered due to the space character or '.' being typed.

    Could Addict be asking SyntaxEdit to do something that is bogging it down? Like parse to the beginning or end of the CSS? Or is the problem likely to be in the Addict spell checker? Do you have any ideas? I don't know how all this works internally.

    I managed to capture a stack trace while the program was bogged down.... perhaps the below is useful?

    :77372bcc ntdll.NtCallbackReturn + 0xc
    :7737505d ntdll.KiUserCallbackDispatcher + 0x4d
    :765538ef USER32.SendMessageW + 0x6f
    :00ef7c3e ; EnsureLineCurrent
    :00ef7e3f Ad3winapiparser::TWinAPIControlParser::MoveNext + 0x17
    :00ef3f21 ; NextWord
    :00f16114 ; CheckCorrect
    :00f13c05 Ad3liverichedit::TAddictLiveRichEdit::WMKeyUp + 0x25
    :00f16d3c ; SubclassWndProc
    :00787A86 System::Classes::StdWndProc(Window=????, Message=257, WParam=????, LParam=????)
    :7655ef5b USER32.AddClipboardFormatListener + 0x4b
    :76555eca ; C:\WINDOWS\SysWOW64\USER32.dll
    :76553c3a ; C:\WINDOWS\SysWOW64\USER32.dll
    :76553a00 USER32.DispatchMessageW + 0x10

  • So any new thoughts based on the new information I provided? Is it something you can resolve since it seems to be an issue with the interaction between SyntaxEdit (only when syntax highlighting is on) and the Addict spell checker?
  • So far I've found that the behavior depend on SyntaxCheckTokens property value. Clearing this property improves performance.

    If the property is not empty, syntax edit will filter text content which should not be spell-checked (replacing with spaces) in lines of text returned to Addict. And so, most of the lines of text reported to Addict will be empty whitespace. 

    At the same time it seems that Addict iterates lines until it finds first word (not white space). Every time I press "space" in the middle of your big file, around 60000 empty lines are skipped by Addict, don't yet know why.
  • Interesting. Thanks.

    Clearing SyntaxCheckTokens seems like it would cause spell checking not to work as desired.

    Addict skipping 60000 empty lines every time someone presses space is a significant issue.

    I don't think Addict is supported anymore, unfortunately... so I don't think I'm even going to ask them about this.

    Fortunately I don't think this is a big issue because most people don't edit such large files.... but if you know of a workaround or solution that wouldn't be too hard to implement then I'd love to know.

    Strangely it still seems to be a problem when I turn off Live Spelling... so maybe I can totally remove the SyntaxEdit component from the Addict control/component list to at least "fix" it when Live Spelling is off.... I will investigate that.

Sign In or Register to comment.