[GH-ISSUE #322] IDE CodeEditor stuttering #98

Closed
opened 2026-05-05 03:39:41 -06:00 by gitea-mirror · 19 comments
Owner

Originally created by @yecate on GitHub (Nov 18, 2025).
Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/322

The latest version of the IDE has stuttering/lag issues when scrolling with the mouse in the code area on Windows.
After testing, the issue started appearing after this commit was submitted.

CtrlCore: Win32 now using BITMAPV5HEADER

Originally created by @yecate on GitHub (Nov 18, 2025). Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/322 The latest version of the IDE has stuttering/lag issues when scrolling with the mouse in the code area on Windows. After testing, the issue started appearing after this commit was submitted. [CtrlCore: Win32 now using BITMAPV5HEADER](https://github.com/ultimatepp/ultimatepp/commit/74169935dd11bee0259c1bbf0a686ccdf1f7e36b)
Author
Owner

@ortman commented on GitHub (Dec 17, 2025):

I agree with you. BITMAPV5HEADER is indeed slower (and BITMAPV4HEADER as well).
If you replace:
bi.bV5Size = sizeof(BITMAPV5HEADER);
with:
bi.bV5Size = sizeof(BITMAPINFOHEADER);
(This is certainly incorrect, but) the lag disappears because the structure is now processed by Windows libraries like the older version. This may be related to alpha channel processing in v5.

<!-- gh-comment-id:3664306289 --> @ortman commented on GitHub (Dec 17, 2025): I agree with you. BITMAPV5HEADER is indeed slower (and BITMAPV4HEADER as well). If you replace: `bi.bV5Size = sizeof(BITMAPV5HEADER);` with: `bi.bV5Size = sizeof(BITMAPINFOHEADER);` (This is certainly incorrect, but) the lag disappears because the structure is now processed by Windows libraries like the older version. This may be related to alpha channel processing in v5.
Author
Owner

@mirek-fidler commented on GitHub (Dec 17, 2025):

That would be unfortunate as I have made the change to process alpha correctly...

What Win is that BTW? (10 or 11?)

<!-- gh-comment-id:3664313758 --> @mirek-fidler commented on GitHub (Dec 17, 2025): That would be unfortunate as I have made the change to process alpha correctly... What Win is that BTW? (10 or 11?)
Author
Owner

@mirek-fidler commented on GitHub (Dec 17, 2025):

For the record, I see no stuttering at all...

There are some situations where theide stutters because of background processes (mostly libclang indexer running) which might look like something new (as it only happens once in a while), but it really is not.

<!-- gh-comment-id:3664320653 --> @mirek-fidler commented on GitHub (Dec 17, 2025): For the record, I see no stuttering at all... There are some situations where theide stutters because of background processes (mostly libclang indexer running) which might look like something new (as it only happens once in a while), but it really is not.
Author
Owner

@ortman commented on GitHub (Dec 17, 2025):

I tested it in Windows 10.
I can test it on Windows 11 later.

<!-- gh-comment-id:3664320678 --> @ortman commented on GitHub (Dec 17, 2025): I tested it in Windows 10. I can test it on Windows 11 later.
Author
Owner

@ortman commented on GitHub (Dec 17, 2025):

The lag is slight, but noticeable. When scrolling down in the IDE with the mouse wheel, the bottom few lines render with a slight delay, as if there's no double buffering during rendering. When scrolling up, the effect is visible at the top of the window. I built two variants of the IDE from the master branch and ran them simultaneously, and the difference is noticeable.

<!-- gh-comment-id:3664357173 --> @ortman commented on GitHub (Dec 17, 2025): The lag is slight, but noticeable. When scrolling down in the IDE with the mouse wheel, the bottom few lines render with a slight delay, as if there's no double buffering during rendering. When scrolling up, the effect is visible at the top of the window. I built two variants of the IDE from the master branch and ran them simultaneously, and the difference is noticeable.
Author
Owner

@mirek-fidler commented on GitHub (Dec 17, 2025):

OK, let me know about Win11...

<!-- gh-comment-id:3664599059 --> @mirek-fidler commented on GitHub (Dec 17, 2025): OK, let me know about Win11...
Author
Owner

@ortman commented on GitHub (Dec 18, 2025):

Yesterday I tested it on Windows 11 Pro. Both versions work identically, no stuttering.
So, the problem is either with Windows 10 or hardware related.

  1. Problem exists: Windows 10 Pro, Intel i3-8100, NVIDIA GTX 1050Ti
  2. Problem doesn't exist: Windows 11 Pro, BeeLink SER5 max (AMD Ryzen 7 5800H, AMD Radeon RX Vega 8).
<!-- gh-comment-id:3668642254 --> @ortman commented on GitHub (Dec 18, 2025): Yesterday I tested it on Windows 11 Pro. Both versions work identically, no stuttering. So, the problem is either with Windows 10 or hardware related. 1. Problem exists: Windows 10 Pro, Intel i3-8100, NVIDIA GTX 1050Ti 2. Problem doesn't exist: Windows 11 Pro, BeeLink SER5 max (AMD Ryzen 7 5800H, AMD Radeon RX Vega 8).
Author
Owner

@ortman commented on GitHub (Dec 18, 2025):

@yecate, On which OS did you observe the problem?

<!-- gh-comment-id:3668645980 --> @ortman commented on GitHub (Dec 18, 2025): @yecate, On which OS did you observe the problem?
Author
Owner

@yecate commented on GitHub (Dec 18, 2025):

@yecate, On which OS did you observe the problem?

windows 11 Pro, Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (3.60 GHz)

<!-- gh-comment-id:3668860410 --> @yecate commented on GitHub (Dec 18, 2025): > [@yecate](https://github.com/yecate), On which OS did you observe the problem? windows 11 Pro, Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (3.60 GHz)
Author
Owner

@mirek-fidler commented on GitHub (Dec 18, 2025):

This is definitely the most weird issue this year :)

yecate, can you confirm that

bi.bV5Size = sizeof(BITMAPINFOHEADER);

changes the the situation? (If yes, then that still is not a fix, but gives more clues...)

<!-- gh-comment-id:3669293991 --> @mirek-fidler commented on GitHub (Dec 18, 2025): This is definitely the most weird issue this year :) yecate, can you confirm that bi.bV5Size = sizeof(BITMAPINFOHEADER); changes the the situation? (If yes, then that still is not a fix, but gives more clues...)
Author
Owner

@yecate commented on GitHub (Dec 18, 2025):

This is definitely the most weird issue this year :)

yecate, can you confirm that

bi.bV5Size = sizeof(BITMAPINFOHEADER);

changes the the situation? (If yes, then that still is not a fix, but gives more clues...)

After making these changes, the tests turned out really well.

GDI takes a more complex path, validating and processing V5-specific fields (color space, ICC profiles, alpha mask, etc.), which adds overhead.

<!-- gh-comment-id:3669655389 --> @yecate commented on GitHub (Dec 18, 2025): > This is definitely the most weird issue this year :) > > yecate, can you confirm that > > bi.bV5Size = sizeof(BITMAPINFOHEADER); > > changes the the situation? (If yes, then that still is not a fix, but gives more clues...) After making these changes, the tests turned out really well. GDI takes a more complex path, validating and processing V5-specific fields (color space, ICC profiles, alpha mask, etc.), which adds overhead.
Author
Owner

@mirek-fidler commented on GitHub (Dec 18, 2025):

What about adding

bi.bV5CSType    =  LCS_sRGB;

?

<!-- gh-comment-id:3669718425 --> @mirek-fidler commented on GitHub (Dec 18, 2025): What about adding bi.bV5CSType = LCS_sRGB; ?
Author
Owner

@ortman commented on GitHub (Dec 18, 2025):

bi.bV5CSType = LCS_sRGB;

It didn't help.

<!-- gh-comment-id:3669754314 --> @ortman commented on GitHub (Dec 18, 2025): > bi.bV5CSType = LCS_sRGB; It didn't help.
Author
Owner

@ortman commented on GitHub (Dec 18, 2025):

I uncommented timing logger
#define LTIMING(x) RTIMING(x)

64 bit CLANG C++17 SIMD Compiled: 12/18/2025 16:32:28 D:\UPP\ide.exe
TIMING HighlightLine  :  2.99 ms -  4.50 us ( 3.00 ms / 664 ), min:  0.00 ns, max:  1.00 ms, nesting: 0 - 664
TIMING DrawSurface    :  1.61 s  - 309.54 us ( 1.61 s  / 5214 ), min:  0.00 ns, max:  2.00 ms, nesting: 0 - 5214
TIMING Image Alpha sw :  1.79 s  - 343.10 us ( 1.79 s  / 5214 ), min:  0.00 ns, max:  2.00 ms, nesting: 0 - 5214
TIMING Image Alpha blit: 35.97 ms - 14.23 us (36.00 ms / 2528 ), min:  0.00 ns, max:  1.00 ms, nesting: 0 - 2528
TIMING Image Alpha create: 58.00 ms - 278.83 us (58.00 ms / 208 ), min:  0.00 ns, max:  2.00 ms, nesting: 0 - 208

AlphaBlend isn't running in hardware?

<!-- gh-comment-id:3669877380 --> @ortman commented on GitHub (Dec 18, 2025): I uncommented timing logger `#define LTIMING(x) RTIMING(x)` ``` 64 bit CLANG C++17 SIMD Compiled: 12/18/2025 16:32:28 D:\UPP\ide.exe TIMING HighlightLine : 2.99 ms - 4.50 us ( 3.00 ms / 664 ), min: 0.00 ns, max: 1.00 ms, nesting: 0 - 664 TIMING DrawSurface : 1.61 s - 309.54 us ( 1.61 s / 5214 ), min: 0.00 ns, max: 2.00 ms, nesting: 0 - 5214 TIMING Image Alpha sw : 1.79 s - 343.10 us ( 1.79 s / 5214 ), min: 0.00 ns, max: 2.00 ms, nesting: 0 - 5214 TIMING Image Alpha blit: 35.97 ms - 14.23 us (36.00 ms / 2528 ), min: 0.00 ns, max: 1.00 ms, nesting: 0 - 2528 TIMING Image Alpha create: 58.00 ms - 278.83 us (58.00 ms / 208 ), min: 0.00 ns, max: 2.00 ms, nesting: 0 - 208 ``` AlphaBlend isn't running in hardware?
Author
Owner

@ortman commented on GitHub (Dec 18, 2025):

If set
bi.bV5Size = sizeof(BITMAPINFOHEADER);
then

TIMING HighlightLine  :  0.00 ns -  0.00 ns ( 0.00 ns / 466 ), min:  0.00 ns, max:  0.00 ns, nesting: 0 - 466
TIMING DrawSurface    : 119.93 ms - 21.91 us (120.00 ms / 5475 ), min:  0.00 ns, max:  1.00 ms, nesting: 0 - 5475
TIMING Image Alpha sw : 250.93 ms - 45.83 us (251.00 ms / 5475 ), min:  0.00 ns, max:  1.00 ms, nesting: 0 - 5475
TIMING Image Alpha blit: 44.98 ms - 24.79 us (45.00 ms / 1814 ), min:  0.00 ns, max:  1.00 ms, nesting: 0 - 1814
TIMING Image Alpha create:  3.00 ms - 16.20 us ( 3.00 ms / 185 ), min:  0.00 ns, max:  1.00 ms, nesting: 0 - 185
<!-- gh-comment-id:3669916835 --> @ortman commented on GitHub (Dec 18, 2025): If set `bi.bV5Size = sizeof(BITMAPINFOHEADER);` then ``` TIMING HighlightLine : 0.00 ns - 0.00 ns ( 0.00 ns / 466 ), min: 0.00 ns, max: 0.00 ns, nesting: 0 - 466 TIMING DrawSurface : 119.93 ms - 21.91 us (120.00 ms / 5475 ), min: 0.00 ns, max: 1.00 ms, nesting: 0 - 5475 TIMING Image Alpha sw : 250.93 ms - 45.83 us (251.00 ms / 5475 ), min: 0.00 ns, max: 1.00 ms, nesting: 0 - 5475 TIMING Image Alpha blit: 44.98 ms - 24.79 us (45.00 ms / 1814 ), min: 0.00 ns, max: 1.00 ms, nesting: 0 - 1814 TIMING Image Alpha create: 3.00 ms - 16.20 us ( 3.00 ms / 185 ), min: 0.00 ns, max: 1.00 ms, nesting: 0 - 185 ```
Author
Owner

@mirek-fidler commented on GitHub (Dec 18, 2025):

I uncommented timing logger #define LTIMING(x) RTIMING(x)

64 bit CLANG C++17 SIMD Compiled: 12/18/2025 16:32:28 D:\UPP\ide.exe
TIMING HighlightLine  :  2.99 ms -  4.50 us ( 3.00 ms / 664 ), min:  0.00 ns, max:  1.00 ms, nesting: 0 - 664
TIMING DrawSurface    :  1.61 s  - 309.54 us ( 1.61 s  / 5214 ), min:  0.00 ns, max:  2.00 ms, nesting: 0 - 5214
TIMING Image Alpha sw :  1.79 s  - 343.10 us ( 1.79 s  / 5214 ), min:  0.00 ns, max:  2.00 ms, nesting: 0 - 5214
TIMING Image Alpha blit: 35.97 ms - 14.23 us (36.00 ms / 2528 ), min:  0.00 ns, max:  1.00 ms, nesting: 0 - 2528
TIMING Image Alpha create: 58.00 ms - 278.83 us (58.00 ms / 208 ), min:  0.00 ns, max:  2.00 ms, nesting: 0 - 208

AlphaBlend isn't running in hardware?

This is when color is not null (meaning only alpha is used, all pixels have the same color). I do not think that can be easily solved using GDI, but I guess it would be better to simply cache adjusted image and use regular blit anyway (will do soon).

In any case it looks like the problem is V5 and DrawSurface, right? Which makes sense IMO...

<!-- gh-comment-id:3669990955 --> @mirek-fidler commented on GitHub (Dec 18, 2025): > I uncommented timing logger `#define LTIMING(x) RTIMING(x)` > > ``` > 64 bit CLANG C++17 SIMD Compiled: 12/18/2025 16:32:28 D:\UPP\ide.exe > TIMING HighlightLine : 2.99 ms - 4.50 us ( 3.00 ms / 664 ), min: 0.00 ns, max: 1.00 ms, nesting: 0 - 664 > TIMING DrawSurface : 1.61 s - 309.54 us ( 1.61 s / 5214 ), min: 0.00 ns, max: 2.00 ms, nesting: 0 - 5214 > TIMING Image Alpha sw : 1.79 s - 343.10 us ( 1.79 s / 5214 ), min: 0.00 ns, max: 2.00 ms, nesting: 0 - 5214 > TIMING Image Alpha blit: 35.97 ms - 14.23 us (36.00 ms / 2528 ), min: 0.00 ns, max: 1.00 ms, nesting: 0 - 2528 > TIMING Image Alpha create: 58.00 ms - 278.83 us (58.00 ms / 208 ), min: 0.00 ns, max: 2.00 ms, nesting: 0 - 208 > ``` > > AlphaBlend isn't running in hardware? This is when color is not null (meaning only alpha is used, all pixels have the same color). I do not think that can be easily solved using GDI, but I guess it would be better to simply cache adjusted image and use regular blit anyway (will do soon). In any case it looks like the problem is V5 and DrawSurface, right? Which makes sense IMO...
Author
Owner

@mirek-fidler commented on GitHub (Dec 18, 2025):

Attempted fix at master...

76ed3e4583

<!-- gh-comment-id:3670095254 --> @mirek-fidler commented on GitHub (Dec 18, 2025): Attempted fix at master... https://github.com/ultimatepp/ultimatepp/commit/76ed3e4583c1bf2679a9a7d5e7829ae228547b16
Author
Owner

@ortman commented on GitHub (Dec 18, 2025):

It works, no stuttering. Thank you very much.

<!-- gh-comment-id:3670177508 --> @ortman commented on GitHub (Dec 18, 2025): It works, no stuttering. Thank you very much.
Author
Owner

@yecate commented on GitHub (Dec 18, 2025):

Well done, thank you.

<!-- gh-comment-id:3670222440 --> @yecate commented on GitHub (Dec 18, 2025): Well done, thank you.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/ultimatepp#98
No description provided.