NotAdam / Lumina

A simple, performant and extensible framework for interacting with FFXIV game data
Do What The F*ck You Want To Public License
101 stars 52 forks source link

Implement stream pooling and more fine grained lock #79

Closed Soreepeong closed 9 months ago

Soreepeong commented 9 months ago

When using multiple threads to call GetFile<T>, the lock was being held per SqPack, which effectively is a .dat file. Changed that to lock per file inside a .dat file, and added SqPackStreamPool? GameData.StreamPool which will reuse already opened file handles to avoid performance hit from creating handle per every file accessed.

The attached test code iterates 800,054 paths from 040000. The test was done on 16 P-threads on 13900k.

SqPackStreamPool_TestCode.txt SqPackStreamPool_TestResult.txt

Notes