BeyondSurvival open source · alpha
← all posts
2026-10-03

Performance pass, round one

performancelua

Before adding more content I wanted to know what each resource costs. The roadmap says one perf pass first, then content. So this week was that.

Honest part first: I did a static review, I did not run resmon yet on a full server. The table with ms before and after is still empty. I will fill it on a live client, idle and in combat, and update the doc.

What I found

Good news is the code is mostly ok. Almost every Wait(0) loop is already gated, like if active then Wait(0) else Wait(500). NUI messages are sent only on change or throttled. Server loops run at 250 ms or slower and there is no database call inside a tight loop.

The bad ones were small and stupid:

  • bs_emotes, bs_interactions and bs_core were calling exports.bs_core:IsLoaded() every single frame. Export calls are not free. Now it’s cached and re-read every 250 ms.
  • bs_core was calling GetHashKey('WEAPON_UNARMED') every frame. Same hash every time, obviously. Cached.
  • The riot shield in bs_gadgets did 4 to 6 joaat() per frame while you hold it. Cached too, even if the shield is parked for now.

None of this changes behaviour. It just stops wasting time.

What’s next

Run the numbers for real. Then the anti-cheat layer, which only makes sense once I know the checks will not cost more than they save.