Skip to content

Used for testing different methods of iterating over a collection that has items periodically added and removed

Notifications You must be signed in to change notification settings

Carnes/IterateOverCollectionTests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

IterateOverCollectionTests

Used for testing different methods of iterating over a collection that has items periodically added and removed

image

Summary: Using a List and for loop is fastest. Adding an object pool will slightly slow it down but drastically save on memory allocations and garbage collections.

image

image

Looking at the dotTrace graph the List and for loop looks really good because it's less than 5% of the GC but that's only because the foreach loop is so bad. When running dotTrace for just the ListAndForLoop with and without object pooling it shows 100% of GCs and memory allocations going to without a pool. 183 GCs vs 0 in a ~10 second period. Object pooling look very worth doing for short duration classes like projectiles, ai tasks, naviation tasks, and so on.

About

Used for testing different methods of iterating over a collection that has items periodically added and removed

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages