ModernUO/Projects
Kamron Batman 708a354337
perf: stop allocating stat/skill mod lists for every mobile (#2604)
## Summary

`_statMods` and `_skillMods` are created lazily by `AddStatMod` / `AddSkillMod` and nulled when they empty, and every reader already null-checks. The eager `new List<T>()` in `DefaultMobileInit` and `Deserialize` therefore allocated two dead 32-byte objects for every mobile. On a ~500k-mobile world that is ~32 MB and 1M gen2 objects that hold nothing.

- Removes the four eager allocations.
- Removes the `StatMods` accessor (no references).
- Documents `SkillMods` as `null` when no mods are active (its one caller in `Skills.cs` already checks).

First of three PRs from the lazy per-mobile collections design; `DamageEntries` and `Aggressors`/`Aggressed` follow separately.

## Breaking change

- `Mobile.SkillMods` may now be `null` (it was never null after construction before). External callers that enumerate it or read `.Count` must null-check.
- `Mobile.StatMods` is removed. Use `GetStatMod(name)` / `AddStatMod` / `RemoveStatMod`.

Save format is untouched: neither list is serialized.

## Testing

- `dotnet build -c Release` clean.
- New `MobileLazyModListTests` plus full `Server.Tests` (840) and `UOContent.Tests` (756).
2026-09-01 23:23:32 -07:00
..
Application fix: Bumps dependencies. (#2531) 2026-07-14 15:17:55 -07:00
BuildTool feat: Bumps dependencies. Introduces Serialization Generator v3 (#2584) 2026-08-22 15:48:53 -07:00
Logger fix: Bumps dependencies. (#2531) 2026-07-14 15:17:55 -07:00
Server perf: stop allocating stat/skill mod lists for every mobile (#2604) 2026-09-01 23:23:32 -07:00
Server.Tests feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00
UOContent feat: event-driven target acquisition with a reaction-time gradient (#2601) 2026-09-01 20:42:15 -07:00
UOContent.Tests feat: event-driven target acquisition with a reaction-time gradient (#2601) 2026-09-01 20:42:15 -07:00