Skip to content

Stop TEG from allocating every atmos tick#1377

Merged
fenndragon merged 1 commit intoHardLightSector:masterfrom
Kronyxxx:copilot/teg-allocation-fix
Apr 23, 2026
Merged

Stop TEG from allocating every atmos tick#1377
fenndragon merged 1 commit intoHardLightSector:masterfrom
Kronyxxx:copilot/teg-allocation-fix

Conversation

@Kronyxxx
Copy link
Copy Markdown
Contributor

About the PR

While looking into whether the TEG could still cause lag, I found the center was allocating fresh GasMixtures every atmos tick, including on the no-flow path.

This swaps that over to reusable per-generator transfer buffers instead, so the TEG keeps doing the same math without constantly feeding the GC.

Why / Balance

No gameplay or balance change intended here.

This is just a small internal cleanup to reduce steady server-side allocation churn from active TEGs.

Technical details

  • added two reusable transfer buffers to the TEG generator component
  • changed the circulator transfer helper to write into those buffers instead of returning new mixtures
  • kept the existing heat transfer / power generation behavior the same

How to test

  • build Content.Server
  • spawn and run a TEG normally
  • confirm it still generates power as expected
  • confirm there are no behavior changes in normal operation
  • optional: profile allocations around TEG atmos updates and verify the per-tick GasMixture churn is gone

Media

N/A

Breaking changes

None

Changelog

No changelog. Internal perf cleanup only.

@fenndragon fenndragon merged commit 4c8d2ac into HardLightSector:master Apr 23, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants