FRAME FASTER THAN PSET

All aspects of programming on the Commander X16.
Post Reply
User avatar
ahenry3068
Posts: 1195
Joined: Tue Apr 04, 2023 9:57 pm

FRAME FASTER THAN PSET

Post 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
TomXP411
Posts: 1806
Joined: Tue May 19, 2020 8:49 pm

Re: FRAME FASTER THAN PSET

Post 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
User avatar
ahenry3068
Posts: 1195
Joined: Tue Apr 04, 2023 9:57 pm

Re: FRAME FASTER THAN PSET

Post by ahenry3068 »

RECT IS SLOWER.

FRAME IS MAYBE 1 TO 3% FASTER
User avatar
ahenry3068
Posts: 1195
Joined: Tue Apr 04, 2023 9:57 pm

Re: FRAME FASTER THAN PSET

Post by ahenry3068 »

I'm timing the entire screen draw
User avatar
ahenry3068
Posts: 1195
Joined: Tue Apr 04, 2023 9:57 pm

Re: FRAME FASTER THAN PSET

Post 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.
User avatar
ahenry3068
Posts: 1195
Joined: Tue Apr 04, 2023 9:57 pm

Re: FRAME FASTER THAN PSET

Post 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.
User avatar
ahenry3068
Posts: 1195
Joined: Tue Apr 04, 2023 9:57 pm

Re: FRAME FASTER THAN PSET

Post 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.
TomXP411
Posts: 1806
Joined: Tue May 19, 2020 8:49 pm

Re: FRAME FASTER THAN PSET

Post 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. :)
Post Reply