SnpM / LockstepFramework

Framework for lockstep RTS, TD, and MOBA games.
MIT License
1.39k stars 348 forks source link

Use arrays or FastCollections #163

Closed WenmingChan closed 5 years ago

WenmingChan commented 6 years ago

I wonder to know why there are many Arrays used,For example,LSAgent[] in AgentController.cs and Ability[] in AbilityManager.cs.And why not use FastCollections instead. when should I use FastCollections or arrays?

SnpM commented 6 years ago

Hey Wenming,

FastCollections use arrays internally. They're faster than List, Hashset, etc. in certain situations because they have less safety checks and have functions that skip garbage collection and iteration (e.g. FastClear).

LS uses FastCollections to significantly speed up high-volume processes like pathfinding.

Sometimes it's easier or faster to just use arrays.

On Monday, September 3, 2018, WenmingChan notifications@github.com wrote:

I wonder to know why there are many Arrays used,For example,LSAgent[] in AgentController.cs and Ability[] in AbilityManager.cs.And why not use FastCollections instead. when should I use FastCollections or arrays?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SnpM/LockstepFramework/issues/163, or mute the thread https://github.com/notifications/unsubscribe-auth/AHXqp4I_MSW2eC9P6vgosIGeI5H6OR8Tks5uXQGegaJpZM4WXWEz .

WenmingChan commented 6 years ago

Thank you!