Optimising Particles - Pooling etc.

BlitzMax Forums/BlitzMax Programming/Optimising Particles - Pooling etc.

"but if you want the fastest and easiest to use.... your BEST bet is to embed a simple single (or double)linked list in your particle type. it's not a TList, all you do is have a global which points to the first particle. each particle points to the next one. that's it. this will be as fast as arrays. add a pool pointer and you remove the memory allocation."

That won't be as fast as arrays, you're reading a per-particle-pointer in order to get to the next particle which is not necessary with arrays and is no faster than using a linked list iterated through in one direction. You also don't remove memory allocation because every time you add another particle on the end of the chain you have to allocate memory for a new instance of a type. All you've really said is use your own linked list structure instead of BRL's.