Page 1 of 1

[0.14.21] Lamps load chunks causing unnecessary lag

Posted: Fri Dec 09, 2016 11:58 am
by GeoStyx
I love lamps. I blueprint them with everything so they are everywhere. I have around 19k of them around the world.
My game update is around 14.5 now. I noticed lamps keep chunks "active" so I tested removing them to see what happens.

After removing all lights with a lua command, Game Update went from ~14.5 -> ~12 and Entity Update went from ~11.3 -> ~8.8


With lamps:
[Complete time used](https://i.imgur.com/7OAuhfm.png)
[Active chunks](https://i.imgur.com/nhusW0r.png)

Without lamps:
[Complete time used](https://i.imgur.com/GDWidd9.png)
[Active chunks](https://i.imgur.com/KY0Iivz.png)

So it seems lamps mark a chunk as "active" making the game take more time to process. It's fine right now for my world, but I plan to double the size so I'm trying to keep things fast. It's sad to me that lights are causing so much game update time :(

Re: [0.14.21] Lamps load chunks causing unnecessary lag

Posted: Fri Dec 09, 2016 12:33 pm
by Rseding91
That's... not a bug.

That's like saying "Inserters cause chunks to be active". Yes, they have to to operate. That's how it works.

Re: [0.14.21] Lamps load chunks causing unnecessary lag

Posted: Fri Dec 09, 2016 12:47 pm
by robyoublind
In theory though, would it not be possible to optimize this by skipping light updates if 1) all lamps in a chunk are not connected to circuit/logistic network; 2) no players can see them? Like, set a flag on a chunk skipLamps = true and change it if these circumstances change? After all, they have a constant predictable electricity drain, so when looping over chunks you can avoid looping over each lamp in it and just cache their amount in each chunk. Am I missing something?

Re: [0.14.21] Lamps load chunks causing unnecessary lag

Posted: Fri Dec 09, 2016 1:02 pm
by GeoStyx
That's what I was thinking. If this could be done it'd really boost performance.
I get what you're saying Rsedding. I'd just think lights are simple/predictable enough to have some kind of caching rather than marking the chunk active like you would for inserters, etc.

But I'm not a dev so maybe it's best to keep it like it is.

Re: [0.14.21] Lamps load chunks causing unnecessary lag

Posted: Fri Dec 09, 2016 1:17 pm
by Valeskas
GeoStyx wrote:I love lamps.
Personally, I would expect default lamps to be treated as single entity, similar to solar panels. If that is not the case, maybe create a world covered with lamps, and submit it here Performance optimization - post your saves.