ModernUO/Projects/UOContent
Kamron Batman ee2cd1d18d
feat: Adds new decay system and SkipSerialization (#2311)
## Summary

- Replaces scan-based decay checking during world saves with an event-driven timer wheel scheduler
- Removes virtual property checks from serialization hot path, achieving 6-8x faster world saves

## Changes

### DecayScheduler (new):
- Timer wheel with 12 HashSet buckets (5-min intervals) + PriorityQueue for active processing
- O(1) register/unregister vs O(n) scan of all items
- Auto start/stop when items exist/empty
- Configurable tick interval with jitter to prevent system synchronization

### Item.cs:
- Added ScheduledDecayTime computed property
- Added UpdateDecayRegistration() called from SetLastMoved(), property setters, AddItem()/RemoveItem()
- Hooks in Visible, Movable, Spawner setters and Delete()

### World.cs:
- Removed _decayQueue, EnqueueForDecay(), ProcessDecay()
- ItemPersistence.Serialize() now tight loop without virtual calls

## Performance

| Metric        | Before     | After     | Improvement |
|---------------|------------|-----------|-------------|
| Items (230K)  | 245K ticks | 34K ticks | 8x faster   |
| Mobiles (43K) | 56K ticks  | 6K ticks  | 9x faster   |
| Total         | 302K ticks | 40K ticks | 7.5x faster |

## Configuration

decay.maxItemsPerTick = 250       # Items processed per tick
decay.tickInterval = 256ms        # Base processing interval
decay.bucketInterval = 5min       # Timer wheel bucket size
decay.jitterMaxMs = 25            # ±25ms tick jitter
2026-01-08 11:43:51 -08:00
..
Accounting chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Assistants chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Commands fix: Fixes adding items with ambiguous type lookup (#2307) 2026-01-06 21:21:29 -08:00
Compression chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Configuration chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Console feat: Adds console commands (#1714) 2024-03-30 09:40:43 -07:00
Context Menus fix: Moves ContextMenu out of core, streamlines code, fixes bugs (#1873) 2024-07-20 21:33:23 -07:00
Engines feat: Adds new decay system and SkipSerialization (#2311) 2026-01-08 11:43:51 -08:00
Gumps feat: Adds grid support for the DynamicGump system (#2306) 2026-01-03 10:12:22 -08:00
Holiday Stuff chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Items feat: Adds new decay system and SkipSerialization (#2311) 2026-01-08 11:43:51 -08:00
Migrations fix: Moves containers/bods/traps/etc to serialization generator (#2310) 2026-01-07 21:55:55 -08:00
Misc fix: Moves containers/bods/traps/etc to serialization generator (#2310) 2026-01-07 21:55:55 -08:00
Mobiles feat: Adds new decay system and SkipSerialization (#2311) 2026-01-08 11:43:51 -08:00
Multis feat: Adds new decay system and SkipSerialization (#2311) 2026-01-08 11:43:51 -08:00
Network feat: Add spawn position caching and spiral scan optimization (#2295) 2025-12-28 02:40:21 -08:00
Regions feat: New Jail System (#2215) 2025-07-16 20:41:21 -07:00
Skills chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Special Systems fix: Fixes adding items with ambiguous type lookup (#2307) 2026-01-06 21:21:29 -08:00
Spells feat: Adds new decay system and SkipSerialization (#2311) 2026-01-08 11:43:51 -08:00
Systems/JailSystem feat: Adds size/style support to gump builders, optimizes EscapeHtml (#2257) 2025-11-23 11:35:31 -08:00
Targets chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Text feat: Adds size/style support to gump builders, optimizes EscapeHtml (#2257) 2025-11-23 11:35:31 -08:00
Utilities chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
World Saves fix: Fixes adding items with ambiguous type lookup (#2307) 2026-01-06 21:21:29 -08:00
Module.cs fix: Fixes sending packets and sidesteps a major issue with stackalloc and PGO in .NET 8 (#1607) 2023-11-21 12:18:20 -08:00
UOContent.csproj feat: Bumps Serialization Generator for better support (#2292) 2025-12-26 14:27:24 -08:00