CollectionPool vs Singleton pattern?

So I am researching methods to handle a research/unlock tree for the player. I am wondering what is the difference between using a DictionaryPool vs using a Singleton with a Dictionary.

I haven’t had any luck finding examples or use cases concerning using a Collection or Dictionary pool and am hoping someone can either provide more information or somewhere that explains when using them would be ideal?

A research/unlock tree would, naturally, use a tree or node-like data structure. It might be accessed via a singleton, but I’m not sure where a dictionary would come into this, let alone a pooled one.

First of all I’m not sure why you want to reuse/pool collections for research/unlock tree. If you are speaking strictly about interacting with research tree in UI via discrete user actions, you can usually avoid pooling, because UI events are relativly rare to care about GC pressure.

But answering your questions in a vacuum, it depends entirely on a use case.
If you are sure that only one place is holding reference to a collection and doing something with it, then you can use singleton pattern, even though I would just call it “collection in a static variable”. Usually it’s some isolated functionality when you can ensure that nobody is trying to use the same collection simultaneously.

For example, in my job project I have List, when you can have 2 or more cameras blending in each other. We use ECS so this list is part of some entity component. By design you can only have one blend entity holding that list, and each new camera blending is registered in existing blend entity. Blend entity is destroyed when blend list have no elements. In that case I can just put list into static variable, assign it into entity component field and even avoid clearing/returning it when blend entity is destroyed, because by condition it’s already empty and already exist in a static variable.

Another example is queue of effects and each entity can have it’s own queue. In that case you obviously need pool of queues so you can rent and return them in right places.

To sum this up, if you want to use some collection across whole application, use pool, for other cases, well, again use pool, don’t use static variable upfront, optimize if you needed it and if you absolutely sure about what you are doing.

Working on something along the lines of an RTS. They will be able to upgrade units stats, some will be persistent some will be for the current scenario only.

So the idea follows along this framework:

There are ScriptableObjects that have the core stats for units. Upon boot, they will be copied via the Dual Serialization (I think that was pattern name) which will create a working copy and allow for upgrades to be applied to specific units or the unlocking of a new type of unit. There will be different research/unlock trees for different groups of Units. (Scouts, Soldier, Heavies, etc.) and any upgrade would apply to all of the effected unit.

So my current ideas are to have a multiple Dictionaries, one for the unlocks, and one for each research branch. and store them in a Dictionary pool OR to have a Singleton Research/Unlock Manager running a 2D Dictionary.

I haven’t been able to find any examples of when you might use a List or Dictionary Pool and I am unsure as to the benefit that you might get from them.