Skip to content

CardList may need optimization #1

@Fayti1703

Description

@Fayti1703

/* TODO?: Do an optimization pass over this?
* We could take advantage of the unique nature of literally *every single list* here.
* Combat Stacks: Filled one at a time, then rapidly emptied. (Defender stack might have some leftovers.)
* Lane Decks/Attacker Deck: Drained one at a time, then rapidly refilled.
* Discard Piles: Filled slowly, then rapidly emptied.
*
* (honestly optimizing this doesn't matter except for rapidly simulating games, so this is more of an academic thing)
*/

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!)


/* TODO?: Profile array pool usage to get a sense of some better parameters here. */
private static readonly ArrayPool<Card> listPool = ArrayPool<Card>.Create(8, 32);

(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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions