ModernUO/Projects/UOContent/Engines
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
..
Advanced Search chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
BuffIcons feat: Standardizes South/East selection gumps (#1839) 2025-02-14 00:15:14 -08:00
Bulk Orders fix: Moves containers/bods/traps/etc to serialization generator (#2310) 2026-01-07 21:55:55 -08:00
CannedEvil chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Character Creation chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Chat fix: Fixes thread guard and cleans up incoming packet reader (#1641) 2023-12-19 17:04:09 -08:00
ConPVP feat: Adds new decay system and SkipSerialization (#2311) 2026-01-08 11:43:51 -08:00
Craft chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Doom chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Ethics fix: Fixes ethics causing crashes when not used (#1972) 2024-10-15 17:02:11 -07:00
Events fix: Streamlines event scheduler API. Adds months to weekly recurrence (#2178) 2025-05-07 22:42:44 -07:00
Factions chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Harvest chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Help feat: Adds size/style support to gump builders, optimizes EscapeHtml (#2257) 2025-11-23 11:35:31 -08:00
Khaldun fix: Moves containers/bods/traps/etc to serialization generator (#2310) 2026-01-07 21:55:55 -08:00
ML Quests fix: Moves containers/bods/traps/etc to serialization generator (#2310) 2026-01-07 21:55:55 -08:00
Party chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Pathing feat: Refactors A* Movement to use PriorityQueue (#2244) 2025-07-26 15:53:06 -07:00
Plants feat: Adds new decay system and SkipSerialization (#2311) 2026-01-08 11:43:51 -08:00
Player Murder System chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Quests feat: Adds new decay system and SkipSerialization (#2311) 2026-01-08 11:43:51 -08:00
Spawners feat: Adds new decay system and SkipSerialization (#2311) 2026-01-08 11:43:51 -08:00
Stealables fix: Consolidates Color/Center html (#1762) 2024-05-07 23:56:32 -07:00
Treasures of Tokuno fix: Optimizes items to use default weights. (Part 1) (#2240) 2025-07-24 14:44:39 -07:00
UltimaStore fix: Fixes thread guard and cleans up incoming packet reader (#1641) 2023-12-19 17:04:09 -08:00
Veteran Rewards fix: Moves containers/bods/traps/etc to serialization generator (#2310) 2026-01-07 21:55:55 -08:00
Virtues feat: Add spawn position caching and spiral scan optimization (#2295) 2025-12-28 02:40:21 -08:00