Skip to content

[BUG] MenuAPI instances significantly load CPU #115

@PlaneJelly

Description

@PlaneJelly

SwiftlyS2 Version

v1.0.1

Game

Counter-Strike 2

Operating System

Linux

Bug Description

Each MenuAPI instance creates a lot of CPU load. It is very likely caused by work the Task at SwiftlyS2.Core.Menus.MenuAPI line 156 is doing each 7.8ms.

Steps to Reproduce

  1. Run plugin without any MenuAPI instances and check CPU usage
  2. Add more than 20-30 MenuAPI instances with or without options
  3. Run the plugin and compare CPU usage to what it was in step 1

Expected Behavior

Menus should not put any significant load on CPU. Preferably they should have an OnTIck loop which refreshes menu status for each player once a tick, if the player has no menu open it skips the player to not do pointless work.

Actual Behavior

Each MenuAPI instance puts some load on the CPU which with a lot of instances results in high CPU load when server is idle, this CPU usage is significantly higher when player/s connect to the server.

Logs/Console Output


Plugin Information

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions