The curious case of the SuperBASIC speed difference.

A place to discuss general QL issues.
Post Reply
stephen_usher
Gold Card
Posts: 433
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

The curious case of the SuperBASIC speed difference.

Post by stephen_usher »

I made a bit of a personal discovery last night whilst just writing a test program when mucking about with the B&W telly.

The same QL with a Trump Card is faster.

I wrote a little program:

Code: Select all

10 CLS
20 SDATE 2020,7,22,0,0,0
30 PRINT DATE$
40 FOR x=0 TO 10000
50 AT 1,0
60 PRINT x
70 NEXT x
80 PRINT DATE$
On the unexpanded QL (JS ROM) this takes either 3m 15s or 3m 17s (nothing in between and it seems random which one you get) but with the Trump Card installed it's 3m 2s or 3m 3s. That's quite a difference. Any idea why this may be the case? These are both with a clean power-up and the program typed in.


User avatar
tofro
Font of All Knowledge
Posts: 2701
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: The curious case of the SuperBASIC speed difference.

Post by tofro »

stephen_usher wrote:I made a bit of a personal discovery last night whilst just writing a test program when mucking about with the B&W telly.

The same QL with a Trump Card is faster.

On the unexpanded QL (JS ROM) this takes either 3m 15s or 3m 17s (nothing in between and it seems random which one you get) but with the Trump Card installed it's 3m 2s or 3m 3s. That's quite a difference. Any idea why this may be the case? These are both with a clean power-up and the program typed in.
That is caused by the memory layout of the QL that shares screen memory and main memory. The lower 128k RAM are being accessed both by the CPU and the ULA, making memory accesses to that region effectively ~50% slower (because CPU and ULA have to wait for each other until an access to that memory is finished).

SuperBASIC programs mainly execute code from ROM (which is uncontended), so only data access to variables and the program code in lower memory is slowed down - The effect is even worse with machine code programs that mainly execute code from RAM. On a Trump card, preferred memory allocation is from top to bottom, so most data is located in non-contended memory.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
stephen_usher
Gold Card
Posts: 433
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: The curious case of the SuperBASIC speed difference.

Post by stephen_usher »

Ah, I didn't realise that above 128K it was uncontended, I thought that it was all compromised by video access.


User avatar
tofro
Font of All Knowledge
Posts: 2701
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: The curious case of the SuperBASIC speed difference.

Post by tofro »

stephen_usher wrote:Ah, I didn't realise that above 128K it was uncontended, I thought that it was all compromised by video access.
Nope, and this is why really well-designed memory extensions can speed up a QL significantly.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Post Reply