Page 1 of 1
FRAME FASTER THAN PSET
Posted: Wed Jun 14, 2023 10:34 pm
by ahenry3068
Was playing with some BASIC code. Screen 128/$80
Filling the screen with two nested FOR loops using PSET.
Switched PSET to FRAME with X1=X2 and Y1=Y2 which does
exactly the same thing as PSET.
The code with FRAME filled the screen marginally faster.
This means PSET could benefit from a little optimization.
I tried the same thing with RECT and it was a little slower than PSET
Re: FRAME FASTER THAN PSET
Posted: Wed Jun 14, 2023 11:47 pm
by TomXP411
Are you sure about this? My test shows RECT is a good 57% slower than PSET for setting single pixels.
here's my test code
100 SCREEN 128
110 T1=TI
120 FOR Y=0 TO 10
130 FOR X=0 TO 319
140 PSET X,Y,2
150 NEXT
160 NEXT
170 PRINTTI-T1
180 INPUT
210 T1=TI
220 FOR Y=11 TO 21
230 FOR X=0 TO 319
240 FRAME X,Y,X,Y,3
250 NEXT
260 NEXT
270 PRINTTI-T1
Re: FRAME FASTER THAN PSET
Posted: Wed Jun 14, 2023 11:48 pm
by ahenry3068
RECT IS SLOWER.
FRAME IS MAYBE 1 TO 3% FASTER
Re: FRAME FASTER THAN PSET
Posted: Wed Jun 14, 2023 11:49 pm
by ahenry3068
I'm timing the entire screen draw
Re: FRAME FASTER THAN PSET
Posted: Wed Jun 14, 2023 11:50 pm
by ahenry3068
I'm running multiple instances of the emulator while I'm doing this so it's possible
I'm not getting the correct results. Could be OS timing.
Re: FRAME FASTER THAN PSET
Posted: Wed Jun 14, 2023 11:52 pm
by ahenry3068
I had about 7 instances of the emulator running....
I'll hold off judgement until I run it on Hardware...... lol
It was a very minor difference.
Re: FRAME FASTER THAN PSET
Posted: Thu Jun 15, 2023 12:04 am
by ahenry3068
I thought the result was strange myself... I killed all my instances of the emulator
and opened up just 1.......
I ran your code and I did indeed find that FRAME benchmarked slower
But on my system it was only about 30% slower not 57%....
I guess the system and OS make a difference too.
Re: FRAME FASTER THAN PSET
Posted: Thu Jun 15, 2023 7:20 am
by TomXP411
What are the numbers you got?
I got 185 and 291.
291/185 is 1.57 and 185/291 is 0.63.
So depending on how you do the math, you can say that 291 is 57% slower, or that 185 is 0.63 times 291, making PSET 37% faster.
I guess it depends on your point of reference.
![Smile :)](./images/smilies/icon_e_smile.gif)