Fayti1703 / BinaryMatrixPlayer

ASP.NET-based Binmat Player
Mozilla Public License 2.0
2 stars 0 forks source link

`CardList` may need optimization #1

Open Fayti1703 opened 8 months ago

Fayti1703 commented 8 months ago

https://github.com/Fayti1703/BinaryMatrixPlayer/blob/325aa5b86a717b7c4ab76c900aeac7fc75ff0b53/BinaryMatrixEngine/CardList.cs#L7-L14

This comment was written before CardList::MoveAllTo was introduced and at a time that CardList::TakeFirst still had usages -- as such, this may be outdated. Running some benchmarks would still be good here, I think. (Particularly to figure out if this is even an area that needs attention!)


https://github.com/Fayti1703/BinaryMatrixPlayer/blob/325aa5b86a717b7c4ab76c900aeac7fc75ff0b53/BinaryMatrixEngine/CardList.cs#L28-L29

(calls ArrayPool::Create(int maxArrayLength, int maxArraysPerBucket))

Some simple benchmarking and tracking of average list lengths, along with free/used;reused/newly allocated stats would be good here. These parameters were arbitrarily chosen by a neural network (read: I made them up) instead of any hard data.

Fayti1703 commented 8 months ago

It looks like ArrayPool internally pushes performance information into the event source System.Buffers.ArrayPoolEventSource. I don't know how you'd subscribe yourself to that, but it looks promising.

Fayti1703 commented 7 months ago

Resource: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/eventsource-getting-started Resource: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/well-known-event-providers#systembuffersarraypooleventsource-provider