baaron4 / GW2-Elite-Insights-Parser

Binary parser for the .evtc files that arcdps generates after a boss encounter. This will generate a .html file where the results can be easily reviewed.
MIT License
136 stars 48 forks source link

[WIP] Perf. #933

Closed SaculRennorb closed 1 week ago

SaculRennorb commented 3 weeks ago

Ok, this is taking way longer than expected. I'm also somewhat busy with other things right now, so I'll just open this pr for scrutinization.

This pr also:

This means it touches basically every file, but don't be afraid: just tell git to ignore whitespaces, that already cuts out 85% of the changes.

Regarding the numbers:

I should also mention that there are some changes like the the explicit naming of variables that can easily be changed back in case you prefer it that way, but for now i left everything the way i was working with it.

I will also paste some notes i wrote down during the whole process, and while you didn't ask for a code review i necessarily read a lot of the codebase so it also has some recommendations at the end:

Some notes on genral changes and preformance optimizations:

Recommendations and future work:

Code style / architecture:

Tests:

Performance:

SaculRennorb commented 2 weeks ago

Just a short remark on how I arrived at the performance improvements:

Some of them are obvious, but i never pull them out of thin air. If i'm uncertain about a change I first test out the generated code in sharplab.

For example https://sharplab.io/#v2:D4AQTAjAsAUCAMACEEAsBuWIDMyyIGFEBvWRcxAGQEsBnAFwB5qA7egPkQHEBTegVRbUAjgFceAOQAKBAJIARWgAoAlGQqkYFbcgDs6nYgDaBwxQgAaRGCvYrqU9oC6mLRQC+p2QCUeAQwATAHkWABsATxoGZjZOXgEhMUkZBVoICFVTTTM9RwoTNxzyS2tbezzyF1NPQsRWeiMnbj5BEXFpOUUwTNrssxB9Wu0CovMrG0Q7RAchiiramu1fQJCIgGUABz8WGI5mhLbkztpsHu0+wwGK42uKAFYrADYrXSsADmv57Rr3IA==

Is a comparison between the initialization code that gets generated for several comparable methods that just return a list of numbers, showing that for the readonly case the readonly span is vastly superior to all other variants

EliphasNUIT commented 1 week ago

Thanks!

EliphasNUIT commented 1 week ago

To be investigated: ArrayPool seems to allocate too much memory, memory useage increases up to a point while re-parsing a single file.

SaculRennorb commented 6 days ago

940 just linking this as the resolution to the memory thing, in case someone finds this later on