saul / demofile-net

Blazing fast cross-platform demo parser library for Counter-Strike 2 and Valve's Deadlock, written in C#.
MIT License
96 stars 8 forks source link

Add multi-threaded parsing #51

Closed in0finite closed 3 weeks ago

in0finite commented 7 months ago

Benchmark (6 cores):

Method Job Arguments Mean Error StdDev Ratio RatioSD Gen0 Gen1 Gen2 Allocated Alloc Ratio
ParseDemo Job-PEXGNK /p:Baseline=true 1,486.5 ms 6.50 ms 6.08 ms 1.00 0.00 26000.0000 1000.0000 - 489.9 MB 1.00
ParseDemo Job-MQEQFA Default 1,485.7 ms 6.48 ms 6.06 ms 1.00 0.00 26000.0000 1000.0000 - 489.9 MB 1.00
ParseDemoMT Job-PEXGNK /p:Baseline=true NA NA NA ? ? NA NA NA NA ?
ParseDemoMT Job-MQEQFA Default 447.2 ms 23.40 ms 21.89 ms ? ? 34000.0000 11000.0000 1000.0000 582.88 MB ?
saul commented 6 months ago

Many thanks for this! I've built on this as part of #52 - simplifying the API and integrating all of the integration tests.

It's still WIP as there are a couple of bugs that need resolving, but this is a great improvement to performance. Thanks again

in0finite commented 6 months ago

Alright.

Btw, it seems that your implementation is slightly slower (540 ms compared to 450 ms), even if Mac has higher CPU count. Will test it when you merge, to verify.