[0.11.6] Performance problems

This subforum contains all the issues which we already resolved.
cyanit
Burner Inserter
Burner Inserter
Posts: 9
Joined: Tue Dec 16, 2014 4:27 pm
Contact:

[0.11.6] Performance problems

Post by cyanit »

Hello,

on my recent savegame I have got huge performance issues. The game runs at 9fps unless I set factorio.exe to high priority. By doing that I get 15fps (as seen in the screenshots).
http://imgur.com/a/jiLjl

Also on normal priority the game only takes 30-40% of CPU usage (~60% on high)
I also want to add that I didn't have this problem on older saves which contained larger factories. I usuall got 40+ fps even in the endgame.

Unlike normal games I decided to ignore Solar completely and pollute like a madman, as seen by the healthy red map on the screenshots. Maybe this affects performance?

My PC:
  • OS: Windows 7 64Bit
  • CPU: E8400 (3Ghz)
  • RAM: 4 GB
  • GPU: Nvidia GTS 450
Here is a link to the savegame.
https://drive.google.com/file/d/0B-X9Yq ... hvb1k/view


Thanks in advance.

User avatar
cpy
Filter Inserter
Filter Inserter
Posts: 839
Joined: Thu Jul 31, 2014 5:34 am
Contact:

Re: [0.11.6] Performance problems

Post by cpy »

Debug screen uses a lot of FPS, try turning off everything except FPS display when using debug menu.

cyanit
Burner Inserter
Burner Inserter
Posts: 9
Joined: Tue Dec 16, 2014 4:27 pm
Contact:

Re: [0.11.6] Performance problems

Post by cyanit »

I just tried this. With only FPS showing I get FPS/UPS: ~16/~48

User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: [0.11.6] Performance problems

Post by cube »

0.11.0 has a mechanism that prefers game updates over renders and delays rendering when UPS is lower than 60. There is also a limit that allows at most 2 renders to be skipped, which is what your are experiencing -- you have three updates per 1 render, which is exactly 48 ups / 16 fps. In the older versions renders and updates were always together (FPS was always equual to UPS). Now Factorio sees that you cannot run at 60, and tries to save some time by skipping rendering. It probably gives you a few updates per second more, but not enough to reach 60...

This mechanism will probably need some more tuning in the future. I'm moving this thread to bug reports so it doesn't get lost.

cyanit
Burner Inserter
Burner Inserter
Posts: 9
Joined: Tue Dec 16, 2014 4:27 pm
Contact:

Re: [0.11.6] Performance problems

Post by cyanit »

So it is my CPU creating a bottleneck which causes the game to slow down to compensate?

I just loaded an older savegame to look how it runs. This one runs really well with 30-60 fps (30 when all zoomed out and 50-60 when not)
Now I don't know what all the numbers on the Debug screen mean and how taxing this is on my PC compared to the other save so I'm adding the screenshots for reference.

http://imgur.com/a/dDqzR

User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: [0.11.6] Performance problems

Post by cube »

Yes, it seems to be that way. In the other batch of screenshots your update times are almost good enough, which is why there is sometimes 60fps and sometimes 30fps, but always 60ups.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.11.6] Performance problems

Post by Rseding91 »

cube wrote:0.11.0 has a mechanism that prefers game updates over renders and delays rendering when UPS is lower than 60. There is also a limit that allows at most 2 renders to be skipped, which is what your are experiencing -- you have three updates per 1 render, which is exactly 48 ups / 16 fps. In the older versions renders and updates were always together (FPS was always equual to UPS). Now Factorio sees that you cannot run at 60, and tries to save some time by skipping rendering. It probably gives you a few updates per second more, but not enough to reach 60...

This mechanism will probably need some more tuning in the future. I'm moving this thread to bug reports so it doesn't get lost.
Since the render thread is split from the game update thread I assume that "skipping the render" is because the update thread still has to give all the information over to the render thread for the new state? (or the render has to get it from update w/e order it uses).

I'm just trying to understand how the system works as it is now. My game will run at 60 UPS with an update time of 15 MS/tick (right at the verge of maximum) while the update thread is reporting 4-5 MS/tick. Adding them together and it should push over the maximum time 1 update can take to keep a full 60 UPS.

It would be interesting to see a option to disable the "skip render if UPS isn't at max" just to see how it impacts the game.

Mostly, I just like to know stuff :)
If you want to get ahold of me I'm almost always on Discord.

User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: [0.11.6] Performance problems

Post by cube »

Render and update can run in parallel, but there must be one prepare step before every render (collecting the data) and that cannot be paralelized with update, so now the render thread looks if there is enough time to spend time(prepare) + max(time(render) + time(update)) and if there isn't, it skips the prepare and render. At least that is the general idea, details are a little more complex.

User avatar
GewaltSam
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu May 08, 2014 5:42 pm
Contact:

Re: [0.11.6] Performance problems

Post by GewaltSam »

We got a pretty big factory so far, and my fps dropped to around 6.5, which isn't much fun if you also have to handle 200ms ping (my mate lives on the other side of the planet right now). Now, i was pretty sure that RAM was my problem as I only got 4gb, and they were nearly completely used while factorio was running - so I went and got another 4GB (actually, completely new 2x 4GB).

Now, the performance did not change one bit, so I think the CPU (4 core AMD Phenom II) might be the problem. What I don't understand, though: when I look at my task manager, Factorio uses not even 30% of my CPU, and 50-60 percent are idle. Are you guys sure that this isn't a problem with Factorio itself, and not with my hardware? I got FPS/UPS 7.2/21.6 right now, while my CPU usage is at 40%, and around 3gb RAM are still unused.

I can send the savegame and pictures as requested, if needed.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.11.6] Performance problems

Post by kovarex »

Well there are lot of optimisations of the game update we need to do. The save is always helpful for testing of the optimisations.

User avatar
GewaltSam
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu May 08, 2014 5:42 pm
Contact:

Re: [0.11.6] Performance problems

Post by GewaltSam »

Sure thing, here you go:

https://dl.dropboxusercontent.com/u/113 ... SO2.39.zip

Many moving parts, complex train system which might be part of the performance problem.
My friend told me that he has 60 fps when running it single-player on his high-end mac (so, my hardware has some part in it, although it doesn't explain the unused cpu and memory). I got the same performance no matter if I start the map SP or MP.

Changing of graphics settings doesn't help much (it might even make the fps worse), and the video card shouldn't be the bottle neck here. And I discovered a funny thing: When I resize the factorio window and make it smaller, it also runs worse - the framerate climbs back to normal when I make it bigger again. Might have to do with resolution cropping or something, just thought it might be worth mentioning.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.11.6] Performance problems

Post by kovarex »

GewaltSam wrote:Sure thing, here you go:

https://dl.dropboxusercontent.com/u/113 ... SO2.39.zip

Many moving parts, complex train system which might be part of the performance problem.
My friend told me that he has 60 fps when running it single-player on his high-end mac (so, my hardware has some part in it, although it doesn't explain the unused cpu and memory). I got the same performance no matter if I start the map SP or MP.

Changing of graphics settings doesn't help much (it might even make the fps worse), and the video card shouldn't be the bottle neck here. And I discovered a funny thing: When I resize the factorio window and make it smaller, it also runs worse - the framerate climbs back to normal when I make it bigger again. Might have to do with resolution cropping or something, just thought it might be worth mentioning.
Well you can't expect to get cpu usage to 100%, that would be only in ideal world :)

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.11.6] Performance problems

Post by kovarex »

So I took a look on the save.

Wow, the factory is really impresively huge, I really love it :)
But I'm not surprised the game is slow on so huge Factory, I would really not consider it as a bug.

But the good news is, that I did profile it (Measured what is slowing the game down the most), and the optimisations I have plans to do should help a lot.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.11.6] Performance problems

Post by kovarex »

Ok, so I couldn't hold myself from doing it. It was maybe not a good idea when we are trying to stabilise, but the change was quite easy actually.

I optimised the inserter to transport belt loading/unloading and it almost doubled my fps/ups in the factory (9.2/27) -> (17/52).

So this is now prepared for the 0.11.9, so I can move this to resolved for the next release.

P.S. There are lot of other optimisations that I plan to do, so stay tuned for the furture updates as well :)

User avatar
Nova
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Mar 04, 2013 12:13 am
Contact:

Re: [0.11.6] Performance problems

Post by Nova »

You, Sir, are a blessing for the whole programming and gaming community, kovarex. I have no idea what you did, but the whole thing was so... wow...

GewaltSam: "Hey, I'm just a guy playing your game and my massive factory runs slow like hell."
kovarex: "Well, its pretty huge and needs thousand of calculations per frame, we will take a look at some optimizations to help you a bit - later, not now."
kovarex: "LOL, nevermind, I just doubled the FPS with that factory in my coffee break."

:lol:
kovarex wrote:P.S. There are lot of other optimisations that I plan to do, so stay tuned for the furture updates as well :)
We always stay tuned for all your updates. Some break the game, but the next one is always so stunning awesome... I already have written a big post in the "Thank the devs" thread, but after this post I nearly want to write another... :D
Greetings, Nova.
Factorio is one of the greatest games I ever played, with one of the best developers I ever heard of.

User avatar
GewaltSam
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu May 08, 2014 5:42 pm
Contact:

Re: [0.11.6] Performance problems

Post by GewaltSam »

Thanks a lot for taking a look :) We plan to show off the factory at some point anyway, but we're far from done yet. I'm glad the savegame helped with those optimisations you were talking about :) I knew that the simulation has to slow down at some point, especially with an old rig like mine. But it's a good thing that you can still get some more performance out of that engine. Well done, kovarex!

@Nova: Thought something similar while reading it :D

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: [0.11.6] Performance problems

Post by sillyfly »

GewaltSam wrote:Thanks a lot for taking a look :) We plan to show off the factory at some point anyway, but we're far from done yet.
Now I'm intrigued :)
What is this special factory which takes so much to run, and is such a secret project? :)

User avatar
GewaltSam
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu May 08, 2014 5:42 pm
Contact:

Re: [0.11.6] Performance problems

Post by GewaltSam »

Look a few posts back, I posted a savegame there.

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: [0.11.6] Performance problems

Post by sillyfly »

That is impressive! I really like the terrain with all the lakes.
But I have to admit I didn't look around too much - it's a bit frustrating when getting only 10 fps :)

User avatar
GewaltSam
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu May 08, 2014 5:42 pm
Contact:

Re: [0.11.6] Performance problems

Post by GewaltSam »

sillyfly wrote:That is impressive! I really like the terrain with all the lakes.
But I have to admit I didn't look around too much - it's a bit frustrating when getting only 10 fps :)
Now add 200ms ping, and imagine building anything like that :P When the performance tweaks are in, we'll continue and see how far we get until it's too laggy again. Our stretch goal is something like 10-60 RD/h (Rocket Defenses / h ;) )

Post Reply

Return to “Resolved Problems and Bugs”