Download

Loading times after reboot

I’ve recently noticed that the time it takes to load levels in my game vary after rebooting my computer. I’ve put some logs on the objects it is loading in the ASyncLoading.cpp to try and work out why I am getting a large difference in loading times on the initial load of my game.

It seems to be when loading the textures/objects ect for the level, it is possibly doing some background shader compilation or something which is causing an increased time. An example from an initial load of the game (ran through Visual Studio with -game in the command line):


[2015.09.07-11.07.26:806][267]LogTemp: Finished loading /Game/Materials/Level01_Materials/M_Floor_Blue - Time Taken 41.745380
[2015.09.07-11.07.26:806][267]LogTemp: Finished loading /Game/Materials/Level01_Materials/M_Floor_Inst - Time Taken 41.735843
[2015.09.07-11.07.26:807][267]LogTemp: Finished loading /Game/Materials/Level01_Materials/M_Wall_Side - Time Taken 41.565915

All these async loading of the objects for the level then give me a final value of:

[2015.09.07-11.07.29:941][282]LogTemp: Finished loading /Game/Maps/Room01 - Time Taken 45.769956

Now if I close my game and then re-run from Visual Studio, the loading times seem to be vastly reduced:


[2015.09.07-11.10.10:607][729]LogTemp: Finished loading /Game/Materials/Level01_Materials/M_Floor_Blue - Time Taken 9.770880
[2015.09.07-11.10.10:607][729]LogTemp: Finished loading /Game/Materials/Level01_Materials/M_Floor_Inst - Time Taken 9.767188
[2015.09.07-11.10.10:607][729]LogTemp: Finished loading /Game/Materials/Level01_Materials/M_Wall_Side - Time Taken 9.751591

[2015.09.07-11.10.11:280][735]LogTemp: Finished loading /Game/Maps/Room01 - Time Taken 10.664438

The times then stay at the faster times until I reboot my PC. Now I was wondering whether there is some Shader magic I am missing somewhere or whether Unreal somehow keeps some information in memory after the game has closed to allow the files to load up again in a faster way?

If you want to be sure if any shader are compiled for nothing, open windows task manager and watch the process by memory (higher to lower), you should see multiple [Shader compiler] process if that the case.

But I think it is more related to Windows Defender, I added yesterday a rules to ignore all my dev folder and remove UEEditor.exe etc… I think your problem is the first time you boot and start your game windows defender check the application access and stuff which slow down quite a bit your game at first. Check to see if windows defender process is working from the task manager, usually he take 20% cpu while working instead of idling…

I have turned the Defender off before and it made no difference. The odd thing is, I can run my game and load levels 1-3 and any time I run the game before doing a computer reboot, they load at a fast rate. However, if I then go to load level 4 after a while, it will take its time doing ‘something’ and then any subsequent loads are then faster, until I shut down my PC it seems.

After fresh reboot, game content is not cached by the OS, so physical load from the disk takes place.

With enough RAM, consequent game launches are much faster, because most of the content is already cached in memory. This difference is not noticeable if game is on SSD.

Perhaps you would want to consider loading assets Asynchronously, if its applicable for your game. Check out the docs: https://docs.unrealengine.com/latest/INT/Programming/Assets/AsyncLoading/index.html

Check what is going on with TaskManager, you will maybe find something if its not related to caching…

I’m currently using the ‘GetWorld()->ServerTravel(TravelURL);’ to go between levels. The timings I have got are the things that are being loaded from that function, which are being loaded asynchronously.

Also, when the game closes, I am able to run other games and such and fill the RAM quite easily with other applications, yet when I return to the game, it still loads faster than the initial load from a reboot, almost as though it has created some temporary/cached files that it is able to use for the objects in the level. I have also watched the Task manager and nothing out of the ordinary seems to show up whether its the initial boot or a subsequent boot.

So after looking around at the Cached memory, it does seem to increase with each load of more levels so I can only assume that xulture was right with “After fresh reboot, game content is not cached by the OS, so physical load from the disk takes place.”. The issue though I’m having is the ServerTravel() seems to take quite a while (25-30 seconds) on an initial boot, which isn’t exactly ideal. Is there any way of lowering these loading times with some general settings on textures/meshes/materials, or would it be a case of basically removing things out of my level so it has less to load?

Async load of a level does this “lead level and all assets in the background, and when this is ready, start the level”.

I was talking about async loading assets too, when player is nearby, so this “level load” would be much faster; however, it requires a bit of careful planning and some coding to get it going.

As an added benefit, RAM doesn’t get used for ALL assets that are used in the level, just the ones that player can see.

You can eliminate the effect of file caching by clearing the cache before loading levels for loading tests. You don’t have to reboot and you can do this with the little gem provided in the first answer of http://stackoverflow.com/questions/7405868/how-to-invalidate-the-file-system-cache. Works for me in Windows 8.