mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 01:23:51 +00:00
Eliminates repeated MPQ decompression overhead by caching decompressed files in RAM with LRU eviction. Major performance improvement for file access. Problem: - Every readFile() call decompresses from MPQ (expensive!) - M2 models, textures, WMO files decompressed repeatedly - No caching of decompressed data - MPQ decompression is CPU-intensive (zlib/bzip2) Solution: - Added 1GB LRU file cache to AssetManager - Cache hit: instant return of decompressed data - Cache miss: decompress once, cache for future access - LRU eviction when cache full (removes least recently used) - Don't cache files >100MB (avoid giant WMO chunks) - Thread-safe with existing readMutex Implementation: - CachedFile struct: data + lastAccessTime - fileCacheAccessCounter for LRU tracking - Hit/miss statistics for monitoring - Budget: 1GB (modern RAM easily handles this) Performance impact: - First load: same speed (decompress + cache) - Subsequent loads: instant (no decompression) - Expected 70-90% hit rate during normal play - Huge benefit for frequently accessed models Cache stats logged on shutdown to monitor effectiveness. |
||
|---|---|---|
| .. | ||
| adt_loader.hpp | ||
| asset_manager.hpp | ||
| blp_loader.hpp | ||
| dbc_loader.hpp | ||
| m2_loader.hpp | ||
| mpq_manager.hpp | ||
| terrain_mesh.hpp | ||
| wmo_loader.hpp | ||