I noticed major slowdown in my code which seems to be caused by slices.
I have a loop that uses slices to make several arrays one size bigger each iteration.
With one array the speed is ok. With more than one array though the time it takes to perform the slices seems to be non-linear - more arrays equals more severe slowdown.
I tried looking into it and with slices there seems to be a speed 'bump' every so often - whereas normally it takes 0-1ms to perform, it might takes 10ms or more on occasion.
I thought this might be caused by the GC system but even using GCCollect every frame doesn't seem to get rid of the speed bumps.
So, is this normal behaviour or should slices be working faster?
Here's a small test function:
I have a loop that uses slices to make several arrays one size bigger each iteration.
With one array the speed is ok. With more than one array though the time it takes to perform the slices seems to be non-linear - more arrays equals more severe slowdown.
I tried looking into it and with slices there seems to be a speed 'bump' every so often - whereas normally it takes 0-1ms to perform, it might takes 10ms or more on occasion.
I thought this might be caused by the GC system but even using GCCollect every frame doesn't seem to get rid of the speed bumps.
So, is this normal behaviour or should slices be working faster?
Here's a small test function:
Strict GCSetMode 1 Global a[1] Global b[1] Global c[1] Global d[1] Global e[1] Global f[1] Global g[1] Global h[1] Global ms0=MilliSecs() Global ms=0 Global i=0 For i=1 To 10000 ms=MilliSecs() a=a[..i+1] b=b[..i+1] c=c[..i+1] d=d[..i+1] e=e[..i+1] f=f[..i+1] g=g[..i+1] h=h[..i+1] ms=MilliSecs()-ms If ms>10 Print "Loop Time: "+ms+" (i="+i+")" GCCollect() Next Print "Program Time: "+String((MilliSecs()-ms0)/1000.0) End