Bleep
 Guru
 Joined: 09/01/2022 Location: United KingdomPosts: 795 |
| Posted: 09:18pm 07 Dec 2022 |
|
|
|
Hi Peter, I've just found something interesting and unexpected. I've installed your latest release, to have a play with the Pack and Unpack functions. I decided to try packing the colour information in this program, so it only uses half the space, just because. In doing this, so basically replacing the Math Slice with a Memory pack and unpack, the program now runs in 344mS instead of 350mS as in the listing above, for the LCD, of the 22nd Nov. This seems counter intuitive, to me, as I would suspect there is a little bit more work involved in the unpacking, than a straight Slice, whatever the reason, it's magically faster. I tested both versions on the same release, just in case some new compiler optimisation had occurred. I also tried doing this on my VGA version and that sped up from 377mS to 359mS? Interesting. Regards, Kevin.
' Bubble Universe LCD Dim Float u,a,p,q,t,v=0, x=0 Dim Integer g,b,i,j,c(41),d(41),e(41),n(41),nn Dim Integer f(41,41),l(41,41),m(21,41) Const w=MM.HRes/2, h=MM.VRes/2 Const r=(2*Pi)/235, o=h/2 CLS RGB(black):Backlight 95 t=Rnd*10:Math set 3,e()
nn=Peek(varaddr n()) g=0 For i=50 To 255 Step 5 b=0 For j=50 To 255 Step 5 n(b)=RGB(i,j,130):Inc b Next Memory pack nn, Peek(varaddr m(0,g)),42,32 Inc g Next i Do Inc t,0.025:g=0:Timer =0 For i=50 To 255 Step 5 b=0:a=r*i Math Slice f(),g,,c():Math Slice l(),g,,d() Box c(),d(),e(),e(),0,,0 For j=50 To 255 Step 5 u=Sin(i+v)+Sin(a+x):v=Cos(i+v)+Cos(a+x) x=u+t:c(b)=w+u*o:d(b)=h+v*o:Inc b Next Memory unpack Peek(varaddr m(0,g)),nn,42,32 Box c(),d(),e(),e(),0,,n() Math Insert f(),g,,c() Math Insert l(),g,,d() Inc g Next i Print Timer Loop Edited 2022-12-08 07:33 by Bleep |