[boskid][2.0.28] High CPU time in "Electric Network" after creating and destroying many space platforms

This subforum contains all the issues which we already resolved.
jeff.s
Inserter
Inserter
Posts: 24
Joined: Thu Jan 10, 2019 10:49 pm
Contact:

[boskid][2.0.28] High CPU time in "Electric Network" after creating and destroying many space platforms

Post by jeff.s »

After creating and destroying a large number of space platforms, there is abnormally high CPU usage for "Electric network" despite there no longer being any space platforms. This also increases the size of the save file.

The issue persists across reload and restarting the game. I checked this both on the MacOS build (M2 laptop) and the Windows build.

Steps to reproduce

1. Start a new game
2. Open F4 debug menu and enable "show time usage"
3. Create and destroy a large number of space platforms by running this:

Code: Select all

/c
storage.x=0
script.on_nth_tick(1,function()
  storage.x=storage.x+1
  if storage.x > 100000 then return end
  local p = game.forces.player.create_space_platform({name='p'..storage.x,planet='nauvis',starter_pack='space-platform-starter-pack'})
  p.apply_starter_pack()
  p.destroy(10)
end)
4. Observe that "Electric Network" CPU time usage is seemingly linearly increasing
5. Open editor and observe that there are no surfaces aside from Nauvis

Code: Select all

Update: 20.884/17.498/22.520
  Latency update: 0
  Game update: 20.864/17.466/22.495
    Planets update: 0.001/0.000/0.003
    Control behaviors (MT): 0.059/0.016/0.184
    Transport lines (MT): 0.068/0.024/0.145
    Electric+Heat+Fluid+Circuit (MT): 20.714/17.315/22.311
      Electric network: 18.488/15.148/20.101
      Heat network: O
    Fluid flow: 0.000/0.000/0.020
    Entity update: 0.004/0.003/0.026
    Lightning update: 0
    Tile heating update: 0
Here's a save file you can open which will have high CPU usage:
enetwork bug.zip
(2.13 MiB) Downloaded 11 times
Last edited by jeff.s on Sun Dec 22, 2024 7:45 pm, edited 1 time in total.
jeff.s
Inserter
Inserter
Posts: 24
Joined: Thu Jan 10, 2019 10:49 pm
Contact:

Re: [2.0.28] High CPU time for "Electric Network" after creating and destroying a large number of space platforms

Post by jeff.s »

Rseding pointed out it might be the global network not getting destroyed. Indeed if I manually destroy it I don't see the same behavior:

Code: Select all

/c
storage.x=0
script.on_nth_tick(1,function()
  storage.x=storage.x+1
  if storage.x > 100000 then return end
  local p = game.forces.player.create_space_platform({name='p'..storage.x,planet='nauvis',starter_pack='space-platform-starter-pack'})
  p.apply_starter_pack()
  p.surface.destroy_global_electric_network()
  p.destroy(10)
end)
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3357
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [boskid][2.0.28] High CPU time in "Electric Network" after creating and destroying many space platforms

Post by boskid »

Indeed. Fixed for 2.0.29.
Post Reply

Return to “Resolved Problems and Bugs”