CPU usage

Hi,

the editor uses about 25% of my cpu while minimized and doing nothing.
Wouldn’t it be possible to reduce this?

On a related note, is the simulation and rendering stopped when an editor window is minimized? It doesn’t seem so. If I open a second window with a different project or level, the performance and frame rate drop significantly. Even if I minimize one of the windows.

On OS X, Safari has this nice feature, that it completely stops rendering websites, when the window is not visible, i.e. covered by other windows. I guess that would be quite difficult to implement, but detecting minimized windows should be easier. Or are there any technical reasons, why you can’t pause a minimized scene?

The Editor is supposed to not use many resources when minimized. Would you mind posting your OS information? I’ll make sure QA has this on their test list if they don’t already.

Thinking about it more, we should simply make our QA test process and the various test pass documentation and wiki stuff public. On it :slight_smile:

A minimized editor with just a level opened uses around 30% CPU on my machine. The size of the (minimized) window seems to make a small difference, going from ~27% when small, to ~33% when fullscreen. When not minimized, CPU usage is around 35-45% (when doing nothing).

Windows 8.1 Pro
i5 750 @ 2.67GHz
4GB RAM
R9 280X

Do you need any other info that could help? Until now, I just assumed this behavior was normal.

Here ya go,

Windows 8.1 Pro
i7 -3770S 3.1GHz
32GB RAM

I’ve seen this behaviour too. I’m on Windows 8.1.

O_O Now THAT is progressive.

Just to be sure we are talking about the same thing. Minimized to me means in the task bar and no window visible on the desktop. The size of the window doesn’t affect performance much as the majority of the work is independent of window size. E.g. all the UI layout has to happen regardless, all the draw calls happen, etc.

The Editor fully minimized in the task bar should not use significant resources. I know the launcher did at some point (maybe still does?). In any case, we’ll get QA on this to verify with your system spec and follow up and work with you to reproduce.

That’s exactly what I mean by minimized, too. What I meant with window sizes, is that a tiny window, that I minimized uses slightly less CPU than a big window (minimized). But anyway, this is not the main problem and I’m not even sure the difference is significant (it’s just a few %). The main problem is the CPU usage of minimized windows in general. I made a short video (sorry for the potato quality):

?v=N6vo1arpBe0

By the way, the same thing happens on OS X for me. This is why I thought this was normal. On OS X, the CPU usage even seems to go up, when I minimize a window :confused:

?v=G3IJPjMWOHA

Specs:
OS X 10.9.2 (13C64)
2.6 GHz Intel Core i7
8 GB 1600 MHz DDR3
NVIDIA GeForce GT 650M 1024 MB

P.S. Can’t we increase the one video per post limit to 2-3?

Roger roger! Thanks for the report!

Till this is fully looked at you could try entering “t.IdleWhenNotForeground=1” in the console and see whether that works for you. It is a bit more aggressive than idling when minimized, but might be favorable than the status quo to you.

Yup it’s criminal. I can’t help but compare it with Unity which has zero cpu usage when not doing anything in the scene view. UE4 clocks around %33 while idle or minimized…

CPU is still pretty busy when minimized with 4.2.1. I tried the console commands to no avail.

Would be nice if it would reduce (or have an option to reduce) CPU load a bit when it isn’t in focus.

Thanks

I’m not sure how much cpu usage you guys are going for, but when minimized I’m getting about 7.5% on a i7-4770k with 32 gb of ram. With real-time on the viewport enabled (the default setting) I get 22%. t.IdleWhenNotForeground=1 seems to have no effect.

Have you guys considered enabling Vsync for Slate? If we minimize our Slate program, we get the following:

  • Vsync disabled: 20 CPU %
  • Vsync enabled: 0.2 CPU %

Might help.

MattK said: “When the editor is minimized it doesn’t render the windows and won’t run at max framerate (runs at like 5 hz or something) so the cpu usage should be minimal. I’ve tested the vsync suggestion and it is no longer helpful because we don’t draw windows that are minimized in the first place and because of the reduced ticking while minimized. In this case the reason the user is experiencing good results by enabling vsync is because we cap the framerate at 120 fps and vsync is bringing that down to 60. Vsync is unlikely to work in most cases. Usually vsync does not work for windowed but in Win7+ with Aero enabled and running D3D11 you can sync with the DWM. In most cases vsync requires a true fullscreen application to work correctly (which the editor is not). We’ve also reduced the max tick rate to 60hz when running on laptops on battery (we could go somewhat further but much lower will make the editor feel choppy ).”

BTW, 4.3 should have all sorts of goodies in that regard and we are shooting to get CPU usage < 1% when the Editor is minimized.