Optimising Particles - Pooling etc.

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

Hmmm. I posted this in the code archives a while back.
If I use it on any of the examples then it suggests that GC is really not an issue as everything posts either 0 or 1 ms.
I also tried it with GA's AOTMG game and most GC runs were 0/1ms with a single 12ms spike.
I created some code which didn't remove the TLink of a particle but just moved it in the list.
This also suggested GC calls taking 0/1 ms.
In my test case it might be because I have simply replaced an extra TLINK recreated for the particle with a holder for the lastlink. I add a print statement and the GC was running every 200 cycles (with the Print statement probably having a large affect on that) so it really doesn't seem to matter that much from the GC point of view.
Code is in case anybody can spot something wrong or finds it of use :
SuperStrict
bbGCSetDebug(1)

Type ttest
	Field num:Int
	Field link:TLink
End Type

'setup
Local mylist:TList=CreateList()
For Local x:Int=1 To 10
	Local temp:ttest=New ttest
	temp.num=x*2
    temp.link=ListAddLast(mylist,temp)
Next

Local count:Int
While Not KeyHit(KEY_ESCAPE)
    For Local all:ttest=EachIn mylist
		all.num:-1
		If all.num<0 
			MoveToLast(all.link,mylist)
			all.num=20
		EndIf
	Next
	count:+1
	Print "loop done " + count
Wend
Function movetolast(templink:TLink,templist:TList)
                'tried global here as well with no change.
	local temppred:TLink=templist.lastlink()
	templink._succ._pred=templink._pred
	templink._pred._succ=templink._succ
	TempLink._pred=temppred
	templink._succ=temppred._succ
	templink._succ._pred=TempLink
	temppred._succ=TempLink
End Function
Extern
	Function bbGCSetDebug(mode:Int)
EndExtern

So, from what I have seen, it's going to be optimisation in rendering rather than logic that helps the most (as I think a few people have stated already).