>I believe in "don't fix if it is not broken" phylosophy.It is imperative that indexes always be as low as possible because of the way jass arrays allocate memory.
>PUI works as it should and it works well, I have no intention of wasting my time on maybe-improvements.
What are you talking about? PUI is broken as hell by your logic. And it DOESN'T free indexes after 5 seconds. See demo map. Your algorithm vs mine.
By the way, that's only the average index. Would you like to see the max?
Edit: If so...
library TestPUI initializer test uses PUI, Mod private function periodic takes nothing returns nothing globals private integer PUI_Max=0 private integer Mod_Max=0 private integer Index private unit u endglobals set u=CreateUnit(Player(0),'hfoo',0,0,0) set Index=GetUnitIndex(u) if Index>PUI_Max then set PUI_Max=Index endif call RemoveUnit(u) set u=CreateUnit(Player(0),'hfoo',0,0,0) set Index=Mod_GetUnitIndex(u) if Index>Mod_Max then set Mod_Max=Index endif call RemoveUnit(u) call BJDebugMsg("Max Indexes: PUI: "+I2S(PUI_Max)+" | Modded: "+I2S(Mod_Max)+".") endfunction private function test takes nothing returns nothing call TimerStart(CreateTimer(),0.02,true,function periodic) endfunction endlibrary
Shows that PUI with your algorithm breaks when my algorithm is only on about index 3300. (Yes, 8100 to 3300, roughly.)
24.3 KB Views: 253