Facepunch / sbox-issues

175 stars 12 forks source link

Compiling Maps Gets Slower When The Compile Window Is Focused And The Framerate Is High #3700

Open anthonysharpy opened 1 year ago

anthonysharpy commented 1 year ago

Describe the bug

when this window is in-focus (edit: and the framerate is high, like 200-250), compiling maps is slower (about 14% slower in my case):

image

if you make that window lose focus (e.g. minimise s&box or just click the main Hammer window behind it), it's much faster.

i ran some tests and these are results showing the compile times

image

To Reproduce

see above

Expected behavior

not slower

Media/Files

this is the map i used although i would assume it's the same for all maps

map.zip

Additional context

from the discussions below this seems to have something to do with fps_max being set to 0 (which is the default to be fair iirc). if you set it to 60, not only is compiling a bit faster, but the weird behaviour with it getting slower when the window is focused goes away (in fact it actually seems to get a little bit faster when the window is focused). so this might only affect people with higher framerates. even still, would be nice to have this fixed since it's still leaving performance on the table. perhaps a quick fix would be to automatically set fps_max to 5 or something when a map compile is running, and then set it back again when its finished.

Weldify commented 1 year ago

When you focus the compile window do you also focus Hammer? When you unfocus windows, their max update rate is lowered to consume less resources, if you have a crappy PC having Hammer focused could probably influence the compile speed

anthonysharpy commented 1 year ago

When you focus the compile window do you also focus Hammer?

yea. the issue is the compile window since if hammer is focused and the compile window isn't, it's fast.

i have a ryzen 3600x with 16gb ram and a nvidia gtx 1660 super (or something like that) so wouldn't expect a window to have such an impact

Weldify commented 1 year ago

Well what's your fps_max set to?

anthonysharpy commented 1 year ago

Well what's your fps_max set to?

0

Weldify commented 1 year ago

Well that settles it, of course youre going to experience a slowdown when your FPS is uncapped

anthonysharpy commented 1 year ago

i was really skeptical that would make a difference but yeah that seems to stop the speed differences with the window being focused vs unfocused. i will update the issue since it's still ideally something that should be fixed.

Weldify commented 1 year ago

What do you mean? It's not an issue. Just limit your fps to something appropriate. Of course you're going to see slowdowns when your computer is drawing hundreds of frames per second...

anthonysharpy commented 1 year ago

Of course you're going to see slowdowns when your computer is drawing hundreds of frames per second...

not necessarily because afaik vrad etc are running on the CPU but the FPS is mostly coming from the GPU. so it's not a given that limiting the FPS should make a massive difference to the map compile, although clearly it does.

a fix for this could be having it limit resources when a map compile is running. it's not very user friendly that map compiles should be that much slower just because the user didn't know to tweak some random config setting.

Weldify commented 1 year ago

Just limit your fps to something a little above your monitor's refresh rate, it's common sense - a 14% decrease in compile performance isn't even that big considering you don't have an fps cap.