Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize & clean up RadiationSystem #34459

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ElectroJr
Copy link
Member

@ElectroJr ElectroJr commented Jan 16, 2025

About the PR

Over time some PRs have carelessly added some expensive checks to code in radiation system that could be a hot path. This PR removes that, while also just cleaning up parts of radiation system.

Why / Balance

Performance is good

Technical details

  • GetAdjustedRadiationIntensity now avoids allocating a list and returns early. Also no more linq.
  • GetAdjustedRadiationIntensity is now only called once per source & receiver, instead of once per (source+1)*receiver
  • Component fetching and Intensity scaling by stack count is now computed once per source instead of per source*receiver
  • OnIrradiatedEvent is now a struct event
  • RadiationRay is now a struct, and various debug related collections are no longer allocated unless debugging is enabled.
  • RadiationRay now uses EntityUid instead of NetEntity. Debugging uses a separate DebugRadiationRay struct that uses NetEntity.

Media

AFAICT It still seems to work, through I didn't do any thorough testing.

Content.Client_MnqaoYSTyX.mp4

Requirements

Breaking changes

I guess the radiation ray changes are technically breaking, but Its pretty small and I doubt downstreams use the class directly, so probably fine W/O #codebase-changes.

@github-actions github-actions bot added size/M Denotes a PR that changes 100-999 lines. S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. labels Jan 16, 2025
@ElectroJr ElectroJr added P3: Standard Priority: Default priority for repository items. T: Performance Type: Performance impacting changes or bugs T: Cleanup Type: Code clean-up, without being a full refactor or feature and removed S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. labels Jan 16, 2025
@Aeshus Aeshus added D1: High Difficulty: Extensive codebase knowledge required. A: Core Tech Area: Underlying core tech for the game and the Github repository. A: General Interactions Area: General in-game interactions that don't relate to another area. and removed A: Core Tech Area: Underlying core tech for the game and the Github repository. labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: General Interactions Area: General in-game interactions that don't relate to another area. D1: High Difficulty: Extensive codebase knowledge required. P3: Standard Priority: Default priority for repository items. size/M Denotes a PR that changes 100-999 lines. T: Cleanup Type: Code clean-up, without being a full refactor or feature T: Performance Type: Performance impacting changes or bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants