Author Topic: Typing lag  (Read 2065 times)

dunkers

  • Senior Community Member
  • Posts: 778
  • Hero Points: 36
Typing lag
« on: November 02, 2021, 02:12:13 PM »
This has been an issue for the past several versions at least, but I've figured it would resolve itself (or be resolved) at the next upgrade. It hasn't.

The problem is that my keystrokes take a second or so to register. I can type away and there is that lag before I see onscreen what key I've mis-pressed. In any other editor I can backspace and correct it there and then, but in SE I've typed at least another character before I can notice. However, what makes this a big issue now is that I've started to pause after typing to allow SE to catch up to make sure my stuff is correct. And that's not happening after every keystroke, basically.

It's not consistent. When typing code it is usually there, but some types of code seem to be immune. Also, comments tend to be OK, so it looks like tag file stuff perhaps. Sometimes in comments the auto-complete pops up but there is no perceptible delay (or perhaps it just seems like that because it is less), so I don't think it's the pop-up stuff.

I ran the profiler while I created some FreeRTOS timer definition, and attach the result. Any clue as to what to tweak?

Dennis

  • Senior Community Member
  • Posts: 3999
  • Hero Points: 522
Re: Typing lag
« Reply #1 on: November 02, 2021, 07:58:36 PM »
Odd observation here, you have a load of time being spent in AutoCompleteGetKeywords(), which should be nearly instant.  Have you heavily modified your color coding settings?  I guess it could get laggy if your settings introduce thousands of new keywords, otherwise I do not have a very good explanation for why it is spending a lot of time there.  That function was heavily optimized for SlickEdit 2021 (v26).

From your description, it appears that you are getting ahead of Auto-Complete, but if it's getting in your way, then what is *actually* happening is that it is getting ahead of you.  I would recommend increasing the following settings:

Tools > Options... > Editing > Context Tagging > Auto-Complete performance tuning

    Display Auto-Complete after (ms) idle:   (Default 250ms, increase it to a full half-second or more)
    Update Auto-Complete after (ms) idle:   (Default 50ms, increase it to 250ms)

The first setting adjusts when Auto-Complete will kick in and show options, the second adjust how quickly Auto-Complete will recalculate things after you type more characters to further narrow the result.  Increasing both gives you more time to type unimpeded.

The same dialog has "Symbol Coloring performance tuning", which is somewhat the same story.  Increase the following setting to keep Symbol Coloring at bay when you are busy typing.

    Update Symbol Coloring after (ms) idle:   Default 500, make it a full second or more

Also, you can decrease the scope of Symbol Coloring's work by changing this setting:

    Windows to color:   Change it to "Current Window" to make minimize the amount of work Symbol Coloring has to do.

Another tweak to Symbol Coloring performance that may be relevant for you is Document > C/C++ Options... > Appearance > Symbol Coloring > Override color for Library and User Defined keywords (turn it off).  If you have modified your C/C++ Lexer with a ton of new Library or User Defined keywords, you can let Symbol Coloring take the day off when it sees those and trust the colors you have already configured.
« Last Edit: November 02, 2021, 08:01:23 PM by Dennis »

dunkers

  • Senior Community Member
  • Posts: 778
  • Hero Points: 36
Re: Typing lag
« Reply #2 on: November 02, 2021, 09:39:23 PM »
Changed the performance tuning as suggested but didn't notice any effect.

I checked my custom symbol colouring setup with a view to using one of the defaults, but noticed that there is hardly anything in it compared to the supplied ones! I've attached a screeny of that profile.

Just to make sure I switched to profile 'None' with no apparent change. Then I disabled symbol coloring via:
1. View, Symbol Coloring, Enable Symbol Coloring (unticked)
2. Toolls, Options, ..., C/C++,.Appearance, Symbol coloring (unticked)

Also individually unticked 'Highlight unidentified symbols, Override color for Library symbols. None of the above had any effect (on lag).

What did change it was removing a project...
My workspace has a reasonably small active project that I am working on, and reasonably big 'other' project the active one is a part of. The 'other' is actually Espressif's ESP-IDF which is the library and API for the ESP32. The tag file for that is 67MB and although it's a lot of code I'd be surprised if I'm the only one to reference something this size or larger.

If it makes a difference, I have the project set to use workspace tag files. If I remove the ESP-IDF project the tag file increases to 69MB! (Just starting SE25.2 with this workspace reduces the tag file to 160K).

Dennis

  • Senior Community Member
  • Posts: 3999
  • Hero Points: 522
Re: Typing lag
« Reply #3 on: November 02, 2021, 09:44:06 PM »
When I was referring to color coding modifications, I meant Document > C/C++ Options... > Color Coding.  You probably would be aware of it if you had added a lot of symbols there, so it's odd that it showed up in the profiling as a significant contributor.

dunkers

  • Senior Community Member
  • Posts: 778
  • Hero Points: 36
Re: Typing lag
« Reply #4 on: November 02, 2021, 10:08:29 PM »
Oh, right. I've changed the color scheme, of course, but no added symbols or anything.