Page 1 of 1

[StrangePan][2.0.21] SegmentedUnit very high CPU usage

Posted: Sun Nov 24, 2024 11:31 pm
by Sopel
SegmentedUnit at 1ms/tick for me. Asked someone else, they don't have it at all. I think it's some bug. Attaching a save.

https://drive.google.com/file/d/1j8RVHl ... sp=sharing

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Tue Nov 26, 2024 6:38 am
by CodeNyuu
Although I'm not sure exactly, I think it has something to do with the demolishers on Vulcanus. After loading a few saves, the entities labeled as SegmentedUnit and SmokeWIthTrigger only appear after landing on Vulcanus. Loading in new demolisher territories, these values increase very fast.



Before loading new chunks, SegmentedUnit was using 1.1 ms and SmokeWithTrigger using 0.37 ms.
Screenshot 2024-11-25 234739.png
Screenshot 2024-11-25 234739.png (192.67 KiB) Viewed 1277 times


And After loading new chunks, SegmentedUnit shot up to 3.7 ms and SmokeWithTrigger at 1.22 ms.
Screenshot 2024-11-25 235711.png
Screenshot 2024-11-25 235711.png (212.58 KiB) Viewed 1276 times

After running this kill all command,

/c local surface=game.player.surface
for key, entity in pairs(surface.find_entities_filtered({force="enemy"})) do
entity.destroy()
end

The usage dropped nearly down to zero. Although, SegmentedUnit is still at 0.42 ms because I don't think the command kills demolishers that are in unloaded chunks. In the screenshot, you can see spaces where there's still territories.
Screenshot 2024-11-26 000838.png
Screenshot 2024-11-26 000838.png (193.55 KiB) Viewed 1276 times


I do believe this is a bug as it's pretty unreasonable for demolishers to be using this much processing power just to roam around in their territories.

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Tue Nov 26, 2024 4:50 pm
by Sopel
Yes, it is due to demolishers, that's why I have a mod that kills them, as a workaround to this problem. I should have been clearer, sorry.

Code: Select all

    local big_demolisher = data.raw["segmented-unit"]["big-demolisher"]
    local medium_demolisher = data.raw["segmented-unit"]["medium-demolisher"]
    local small_demolisher = data.raw["segmented-unit"]["small-demolisher"]
    big_demolisher.max_health = 1
    big_demolisher.healing_per_tick = -1
    medium_demolisher.max_health = 1
    medium_demolisher.healing_per_tick = -1
    small_demolisher.max_health = 1
    small_demolisher.healing_per_tick = -1

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Tue Nov 26, 2024 6:49 pm
by Loewchen

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Tue Nov 26, 2024 10:36 pm
by Sopel
Loewchen wrote: Tue Nov 26, 2024 6:49 pm 120275
I don't see anything concerning SegmentedUnit in that thread, though yes, it's related.

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Tue Nov 26, 2024 10:57 pm
by Rseding91
Demolishers are segmented units.

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Thu Nov 28, 2024 6:54 pm
by manishearth
I'm also facing this problem. I have low FPS when connecting to a multiplayer server. FPS seems to tank when using lots of bots, but I also have 4ms SegmentedUnit and 1ms SmokeWithTrigger that's just constant. The menu says I have 153 segmented units active.

Can upload map if necessary. My friend who lives closer to the server is not having FPS issues but still sees the 4ms SegmentedUnit costs.

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Thu Nov 28, 2024 7:12 pm
by Loewchen
manishearth wrote: Thu Nov 28, 2024 6:54 pm I'm also facing this problem. I have low FPS when connecting to a multiplayer server. FPS seems to tank when using lots of bots, but I also have 4ms SegmentedUnit and 1ms SmokeWithTrigger that's just constant. The menu says I have 153 segmented units active.

Can upload map if necessary. My friend who lives closer to the server is not having FPS issues but still sees the 4ms SegmentedUnit costs.
Once the fix for this one is live and your issue persists, make a new report following 68653 please.

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Thu Nov 28, 2024 7:35 pm
by manishearth
Thank you! Will do; do you have an estimate on which release I should be waiting for?

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Thu Nov 28, 2024 11:47 pm
by manishearth
Ah, I can just watch the release logs for issue 120275, that works, thanks!

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Sun Dec 01, 2024 8:40 pm
by Musil
same thing for me. wanted to make a thread but found this after looking up segmented unit.
I'm playing a game with an acquaintance.

We swap save files and host the saves on either computer, depending on who starts first.
Up until a few days back, either person could host the game without issue.
Now it's asymmetric.

If I'm hosting, he can play with no ups slowdown. He says his ups are at 60.

If he is hosting, the game that I can run at 56 ups drops down to 5.6 ups.

Save file:

https://drive.google.com/drive/folders/ ... eOYvxAMfDF

Screenshot with time usage attached.

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Sun Dec 01, 2024 8:58 pm
by Musil
We fixed the performance issue for us using this admin tool and hiding explored parts of the map. Segmented unit time use went from 6 ms to 0.09.

https://mods.factorio.com/mod/Delete-Ch ... rom=search

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Fri Dec 06, 2024 12:36 pm
by GeoStyx
Looking forward to this fix - I was really surprised when I checked time usage and it had gone up a ton after exploring for a while on Volcanus. SegemntedUnit is taking up 2.5ms

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Sat Dec 21, 2024 8:35 pm
by Enginenilla
Sopel wrote: Tue Nov 26, 2024 4:50 pm Yes, it is due to demolishers, that's why I have a mod that kills them, as a workaround to this problem. I should have been clearer, sorry.

Code: Select all

    local big_demolisher = data.raw["segmented-unit"]["big-demolisher"]
    local medium_demolisher = data.raw["segmented-unit"]["medium-demolisher"]
    local small_demolisher = data.raw["segmented-unit"]["small-demolisher"]
    big_demolisher.max_health = 1
    big_demolisher.healing_per_tick = -1
    medium_demolisher.max_health = 1
    medium_demolisher.healing_per_tick = -1
    small_demolisher.max_health = 1
    small_demolisher.healing_per_tick = -1
as someone who never modded before, can you please explain how do i use this?

Re: [2.0.21] SegmentedUnit very high CPU usage

Posted: Mon Dec 23, 2024 5:54 pm
by Sopel
Enginenilla wrote: Sat Dec 21, 2024 8:35 pm
Sopel wrote: Tue Nov 26, 2024 4:50 pm Yes, it is due to demolishers, that's why I have a mod that kills them, as a workaround to this problem. I should have been clearer, sorry.

Code: Select all

    local big_demolisher = data.raw["segmented-unit"]["big-demolisher"]
    local medium_demolisher = data.raw["segmented-unit"]["medium-demolisher"]
    local small_demolisher = data.raw["segmented-unit"]["small-demolisher"]
    big_demolisher.max_health = 1
    big_demolisher.healing_per_tick = -1
    medium_demolisher.max_health = 1
    medium_demolisher.healing_per_tick = -1
    small_demolisher.max_health = 1
    small_demolisher.healing_per_tick = -1
as someone who never modded before, can you please explain how do i use this?
you need to make a data-stage mod