# WinPumpMessages - High CPU cost of Windows mouse events

**URL:** <https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012>\
**Category:** Platform & Builds\
**Tags:** unreal-engine, Epic-Pro-Support, question\
**Created:** [June 19, 2025, 8:48pm UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012 "2025-06-19T20:48:46Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [June 19, 2025, 8:48pm UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/1 "2025-06-19T20:48:46Z")

</div>

I’m having an issue where Windows mouse inputs cause a large CPU spike in **WinPumpMessages** , particularly with click events. I added traces to track down where the costs are coming from and it seems to be coming from **FWindowsApplication::SetCapture** and **FWindowsApplication::SetHighPrecisionMouseMode**.

Looking at the code, **FSlateApplication::ProcessMouseButtonDownEvent** will always call **PlatformApplication-\>SetCapture** so I’m assuming it’s supposed to be fast. Can you think of any reason why these calls would be so expensive?

This was seen with Unreal 5.5.4 on Windows 11 Pro (10.0.26100).

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [June 19, 2025, 8:48pm UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/2 "2025-06-19T20:48:49Z")

</div>

**Steps to Reproduce**  
Run an application in standalone mode with tracing enabled and click the mouse.

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [June 20, 2025, 4:59am UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/3 "2025-06-20T04:59:30Z")

</div>

I was able to reproduce the issue in the ShooterGame sample.

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [June 20, 2025, 4:59am UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/4 "2025-06-20T04:59:47Z")

</div>

Here is the trace file.

---

<div class="post-metadata">

**Author:** ![Cody.Albert](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cody.albert/32/1088813_2.png) [@Cody.Albert](https://forums.unrealengine.com/u/Cody.Albert)\
**Post date:** [June 21, 2025, 1:08am UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/5 "2025-06-21T01:08:53Z")

</div>

Hi,

Do you happen to be using a very high DPI mouse? We saw some performance issues related to high DPI mice, and checked in a fix for 5.7 at [CL#42232996](https://github.com/EpicGames/UnrealEngine/commit/b1a6f9bb44d20d6bb0498540359b9ea87e2dbbb4). If you want to try backporting that change, you can use the CVar WindowsApplication.UseWorkerThreadForRawInput to toggle the new behavior and see if it helps. There are a few other relevant fixes there that you may want to grab as well ([CL#42762914](https://github.com/EpicGames/UnrealEngine/commit/2b35219816a1fd5bd3feecad297893366e94838c), [CL#43032922](https://github.com/EpicGames/UnrealEngine/commit/ca289e36353470acc38b146e20f6d2286c946cca), [CL#43352118](https://github.com/EpicGames/UnrealEngine/commit/e52ec9f0b4a73bd1e5ec431d9ba1c1b2db8e9fdc)), hopefully that’s sufficient to improve performance for you.

Best,

Cody

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [June 23, 2025, 10:09pm UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/6 "2025-06-23T22:09:19Z")

</div>

I do have a high DPI mouse but this specific issue is around clicking the mouse button and the subsequent calls to **PlatformApplication-\>SetCapture**. It looks like the behaviour of mouse input (movement & buttons) has drastically changed in the CLs you posted above but I don’t see any changes to the way application capture/focus is handled.

Is this method of handling mouse input going to be the default in 5.7?

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [June 24, 2025, 11:43pm UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/7 "2025-06-24T23:43:46Z")

</div>

I tried bringing those CLs into our version of the engine and it is still displaying the same behaviour with the multiple calls to **SetFocus** within a single button input on the main thread.

---

<div class="post-metadata">

**Author:** ![Cody.Albert](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cody.albert/32/1088813_2.png) [@Cody.Albert](https://forums.unrealengine.com/u/Cody.Albert)\
**Post date:** [July 14, 2025, 9:52pm UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/8 "2025-07-14T21:52:40Z")

</div>

Hi,

I added similar traces, and I’m seeing pretty similar times in Lyra. Here’s an example of a double click:

[Image Removed]The three calls to SetCapture is unfortunate, but at least two of them are probably necessary. The first could be important since we may potentially short circuit the ProcessMouseButtonDown handler via a preprocessor, while the second is the standard SetCapture call for a click. However, the third SetCapture and SetHighPrecisionMouseMode seem a bit redundant, as we should already be in high precision mode (via FSceneViewport::AcquireFocusAndCapture) as long as the viewport is focused and the cursor is hidden.

Any changes here are fairly dangerous since there are a ton of edge cases with input handling, but it may be safe to make some changes to FSlateApplication::ProcessReply to check IsUsingHighPrecisionMouseMode before making any changes:

`// If the mouse is being captured or released, toggle high precision raw input if requested by the reply. // Raw input is only used with mouse capture if (TheReply.ShouldUseHighPrecisionMouse() && !PlatformApplication->IsUsingHighPrecisionMouseMode()) { const TSharedRef< SWindow> Window = CurrentEventPath.GetWindow(); PlatformApplication->SetCapture(Window->GetNativeWindow()); PlatformApplication->SetHighPrecisionMouseMode(true, Window->GetNativeWindow()); ...`We already do a similar check when releasing high precision mode, so I’ll run this by the team and see if there are any concerns. Early results are pretty promising, if you want to give it a try:

[Image Removed]

Best,

Cody

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [July 16, 2025, 9:21pm UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/9 "2025-07-16T21:21:55Z")

</div>

Thanks for the update Cody! I’ll try those changes to **SetHighPrecisionMouseMode**.

I put this code into **SetCapture** :

`void FWindowsApplication::SetCapture( const TSharedPtr< FGenericWindow >& InWindow ) { if ( InWindow.IsValid() ) { if (!bHasCapture) { ::SetCapture( (HWND)InWindow->GetOSWindowHandle() ); bHasCapture = true; } } else { if (bHasCapture) { ::ReleaseCapture(); bHasCapture = false; } } }`The only issue we noticed was around **Alt+Space** which I disabled in the **WindowsEngine.ini** with

`[WindowsApplication] bConsumeAltSpace=True`

---

<div class="post-metadata">

**Author:** ![Cody.Albert](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cody.albert/32/1088813_2.png) [@Cody.Albert](https://forums.unrealengine.com/u/Cody.Albert)\
**Post date:** [July 17, 2025, 7:52pm UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/10 "2025-07-17T19:52:33Z")

</div>

Hi,

I had considered caching the capture state as well, though I had some concerns that it may desynchronize if the capture was ended at the OS level (which I imagine could happen in some cases where Windows wants to take back control). Perhaps we could add some handling for the WM\_CAPTURECHANGED message to properly handle that scenario.

---

<div class="post-metadata">

**Author:** ![Cody.Albert](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cody.albert/32/1088813_2.png) [@Cody.Albert](https://forums.unrealengine.com/u/Cody.Albert)\
**Post date:** [July 30, 2025, 6:20pm UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/11 "2025-07-30T18:20:56Z")

</div>

Hi,

To close the loop on this, I checked in CL#44455025 with a handful of optimizations based on our findings here. Thanks again for bringing that up, and let me know if you run into any issues with those changes!

Best,

Cody

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [August 9, 2025, 5:18pm UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/12 "2025-08-09T17:18:41Z")

</div>

Excellent, thank you for the update and I’m happy to see the changes become official! 🙂

---

<div class="post-metadata">

**Author:** ![gxy438](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gxy438](https://forums.unrealengine.com/u/gxy438)\
**Post date:** [October 13, 2025, 2:16pm UTC](https://forums.unrealengine.com/t/winpumpmessages-high-cpu-cost-of-windows-mouse-events/2652012/13 "2025-10-13T14:16:52Z")

</div>

recommend to avoid the repeat sethighprecisionmousemode, I find it cost higher time than i think , almost 0.5ms, and the note there say it (repeat setting )is used for directx8.

in windowsapplication.cpp
