## Summary Phase #3b (final roadmap item), stacked on #2470. Compacts the index trailer from 20 to 8 bytes/chunk. Trammel: 19.2 MB → 17.9 MB. Roadmap total: 565 MB → 17.9 MB (−96.8%). ## Details - Trailer stores `{ u32 packedKey = (ChunkX << 16) | ChunkY, u32 recordLength }` per chunk, in record write order; the file offset is dropped and reconstructed by cumulative recordLength from HeaderSize. - No record reordering, no varint; fixed-stride, TryReadChunk unchanged. - Also simplifies the accumulated `.swb` code comments across the stack. - Format v8; v7 files rejected and re-baked once. ## Tests v8 multi-chunk round-trip (cumulative offset reconstruction) + the v6/v7 suite; full pathfinding suite green; Release build clean.
31 lines
815 B
C#
31 lines
815 B
C#
using System;
|
|
|
|
namespace Server.Engines.Pathing.Cache;
|
|
|
|
/// <summary>
|
|
/// Periodic backstop that enforces the StaticWalkabilityCache resident-chunk cap.
|
|
/// Steady-state cost is a single early-return; only fires real work when the cache
|
|
/// has overflowed MaxResidentChunks. Runs on the game thread; no locking required.
|
|
/// </summary>
|
|
public class CacheEvictionTimer : Timer
|
|
{
|
|
private static CacheEvictionTimer _instance;
|
|
|
|
public static void Configure()
|
|
{
|
|
if (_instance != null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_instance = new CacheEvictionTimer();
|
|
_instance.Start();
|
|
}
|
|
|
|
private CacheEvictionTimer() : base(TimeSpan.FromSeconds(120), TimeSpan.FromSeconds(120)) { }
|
|
|
|
protected override void OnTick()
|
|
{
|
|
StepCache.Instance.EnforceLruCap();
|
|
}
|
|
}
|