To Anders : speed difference between Basic 1.0 and 1.1

To Anders : speed difference between Basic 1.0 and 1.1

Post by Euphori » Tue, 04 Nov 2003 19:04:04


Hello Anders, I've just read your question in the CEO-mag about a 50% speed
difference between Basic 1.0 (Oric-1) and 1.1 (Atmos): you were wondering if
it was an artifact of Euphoric or something else...
Well, don't worry, it's not an artificial behavior of Euphoric, Basic 1.1
was really optimized in some places, compared to 1.0 (which was really close
to the original Microsoft Basic-65... not so close as the direct port of
Basic-65 to the Microtan-65, but still very close... :-).

Best regards,

Fabrice
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Anders Car » Tue, 04 Nov 2003 19:08:20

"Euphoric" < XXXX@XXXXX.COM > writes:


Heh. It's always interesting to find out that newsgroup messages find
their way into magazines...


Interesting. Back in the 80'ties, I can't recall reading anywhere in
the reviews that Basic seemed to have been speeded up; only bug fixed.
BYTE had in 1977 a series of simple benchmarks which sometimes were
reused to give a rough estimate of Basic speed. It might be worthwhile
to run those on the two Oric models and compare the results with other
Basics if it hasn't been done before.

--
Anders Carlsson

"Please not to close to the hair, finger, clothes to run about the
inside's vehicle, in order to prevent quilt involvement." -- Bit Racer

 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Steve Mars » Wed, 05 Nov 2003 06:00:11


"Anders Carlsson" < XXXX@XXXXX.COM >


I did run some benchmark tests on the Atmos and found that it wasn't much
faster than the Oric-1. The Orics are painfully slow as compared to other
machines, but does beat the Speccy on more complicated functions ;o)
Some of the basic speed was altered by that poke that effects the number of
times the keyboard is scanned IIRC. The Atmos keyboard repeat and cursor
flash is quicker. Under Sedoric this is quicker again.

Steve M
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Anders Car » Wed, 05 Nov 2003 07:17:12

"Steve Marshall" < XXXX@XXXXX.COM > writes:


I just run through the eight benchmarks, but I can't claim my results
to be very reliable:

* They were run in Euphoric (Atmos mode), not a real Oric computer
* The host machine is a 200 MHz Windows 98; not sure if it is enough
* Since I couldn't locate a simple timer, I used my C64 as a timer

However, here are the results compared to premeasured values:

BM1 BM2 BM3 BM4 BM5 BM6 BM7 BM8 Avg
--------------------------------------------------
Oric est. 1.8 15.7 25.5 27.5 33.0 45.5 68.5 140 44.7

BBC (B ?) 0.6 3.2 8.1 8.8 9.9 14.3 21.9 48 14.3
Acorn Atom 0.5 5.1 9.5 10.8 13.9 19.1 31.1 92 22.8
VIC-20 1.4 8.3 15.5 17.1 18.3 27.2 42.7 99 28.7
Apple II 1.3 8.5 16.0 17.8 19.1 28.6 44.8 107 30.4
Dragon 32 1.6 10.2 19.7 21.6 23.3 34.3 50.0 129 36.2
SVI-328 1.6 5.4 17.9 19.6 20.6 30.7 42.2 236 46.7
ZX81 (fast) 4.5 6.9 16.4 15.8 18.6 49.7 68.5 229 51.2
ZX Spectrum 4.8 8.7 21.1 20.4 24.0 55.3 80.7 253 58.5
Atari 600XL 2.2 7.2 19.1 22.8 25.8 37.6 58.3 412 73.1
TI-99/4A 2.9 8.8 22.8 24.5 26.1 61.6 84.4 382 76.6

The simple loops seem to take an awful lot of time, probably an
emulator artifact? On the other hand, the trigonometric test (#8)
is reasonably fast and lifts the machine a number of positions
compared to the others.

Here are the incremental benchmark listings. The listings marked
(new) obviously should be written from scratch, otherwise only
add or change the mentioned lines.

BENCHMARK 1 (new)
-----------------
100 REM TEST 1
110 PRINT "START"
120 FOR K=1 TO 1000
130 NEXT K
500 PRINT "STOP"
550 END

BENCHMARK 2
-----------
120 K=0
130 K=K+1
190 IF K<1000 THEN GOTO 130

BENCHMARK 3
-----------
140 A=K/K*K+K-K

BENCHMARK 4
-----------
140 A=K/2*3+4-5

BENCHMARK 5
-----------
150 GOSUB 600
600 RETURN

BENCHMARK 6
-----------
125 DIM M(5)
155 FOR L=1 TO 5
160 NEXT L

BENCHMARK 7
-----------
157 M(L)=A

BENCHMARK 8 (new)
-----------------
100 REM TEST 8
110 PRINT "START"
120 K=0
130 K=K+1
140 A=K^2
150 B=LOG(K)
160 C=SIN(K)
170 IF K<1000 THEN GOTO 130
180 PRINT "STOP"
190 END

--
Anders Carlsson

"Please not to close to the hair, finger, clothes to run about the
inside's vehicle, in order to prevent quilt involvement." -- Bit Racer
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Euphori » Wed, 05 Nov 2003 15:59:52


"Anders Carlsson" < XXXX@XXXXX.COM > a rit dans le message de


Here is the timer:
10 T1=DEEK(#276)
...
200 T2=DEEK(#276):IF T1<T2 THEN T1=T1+65536
210 PRINT (T1-T2)/100


The emulator counts every cycle and synchronises either with the sound DMA
(if you have a SoundBlaster card) or with the host clock.
Just try this:

WAIT 6000

with your clock in your hand. If it takes 1 minute, the emulator is
perfectly synchronized...

Best regards,

Fabrice
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Anders Car » Wed, 05 Nov 2003 16:42:06

"Euphoric" < XXXX@XXXXX.COM > writes:


Cool. I was considering something like that (or rather making
calls directly to the ROM according to the disassembly I found).

After verifying the WAIT statement takes exactly 60 seconds in the
emulator, I rerun the second benchmark and got the same results;
15.6 seconds* for Oric Atmos or 17.3 seconds* for Oric-1. It looks
like the Oric Basic is one of the slowest ever when it comes to
handling an empty increase-and-compare loop.

Was there any alternative Basics for Oric, i.e. the BBC Basic which I
know floats around even in Z80 versions? I don't know if the hardware
on Acorn's BBC allowed faster execution (after all it is a 1 or 2 MHz
6502 too), but it seems silly that two 6502-based systems would differ
that much in execution speed -- imagine Acorn using a marketing slogan
"60% faster than Oric".

*) compared to VICE xvic: 8.0 seconds, x64: 9.6 seconds

--
Anders Carlsson

"Please not to close to the hair, finger, clothes to run about the
inside's vehicle, in order to prevent quilt involvement." -- Bit Racer
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Euphori » Wed, 05 Nov 2003 20:03:09


"Anders Carlsson" < XXXX@XXXXX.COM > a rit dans le message de


Right, it comes partly from the fact all computations are done using
floating point values (ol' microsoft floating point format : 5 bytes
floating point values, ie. a 4-bytes-mantissa). Using integer variables
(appending a '%' sign to the variable name) is even worse : for each
computation, they are first converted to floating point, then the
computation is done using floating points, and the result finally converted
back to integer.
Also, about 20% of the cpu time is consumed by the interrupt routine that
polls the keyboard...


Yeap, Oric Basic is not fast, that's a fact. :-(
Acorn's Basic is sure a much better Basic, it evolved during several years
to reach a great level...
(in comparison, Oric Basic only went through two versions : a buggy 1.0
release, and a somewhat debugged and slightly improved 1.1 release...)

To be honest, when the company crossed the chanel, a new compiled Basic was
developed in France, it is mostly compatible at the source level.
So, if you try your benchmarks on the Telestrat, you will get much better
results...
And if you replace your loop with something like:

110 COUNT 1000
...
190 UNCOUNT
you will find it damn' fast :-)


Do the VIC and the C64 run at the same clock frequency ?

Best regards,

Fabrice
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Anders Car » Wed, 05 Nov 2003 20:20:09

"Euphoric" < XXXX@XXXXX.COM > writes:


Yep, the same thing happens in Commodore Basic (derived from a one-time
licensed copy of Microsoft Basic, which M$ later regretted as they could
have received lots more license money if they had been paid per user).
However, it takes less space to store the integer variables.


Glbl. Shouldn't the VIA do all the keyboard decoding?


Well, Atom Basic and Electron/BBC Basic look very much different on the
UI (but might share code inside). All the benchmarks were done in 1983/84,
so it is not like comparing an optimized 2003 Basic with something written
twenty years ago.


I might do.


Almost; the more advanced C64 traditionally has an effective frequency
of 0.98 MHz (PAL) when screen is lit while the VIC is about 1.01 MHz.
The numbers may differ a little in NTSC land. If the screen is closed,
the C64 reaches 8.9 seconds in VICE, which is not quite the VIC speed
but a reasonable speed-up.

--
Anders Carlsson

"Please not to close to the hair, finger, clothes to run about the
inside's vehicle, in order to prevent quilt involvement." -- Bit Racer
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Mickael Po » Wed, 05 Nov 2003 20:22:10

>> *) compared to VICE xvic: 8.0 seconds, x64: 9.6 seconds

Nope.

Vic20 is faster than C64.

Dbug
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by drhirud » Wed, 05 Nov 2003 20:31:00


You can speed up the BASIC interpreter by changing the time between 2
keyboard handling interrupts:

DOKE #306,65535

To set the value back to normal:

DOKE #306,10000


For timing right on the Oric you can use the Oric Real time clock,
which is somewhere else in this newsgroup archive.



To my knowedge the VIC's main CPU is clocked at 1.01 MHz, while the
C64's CPU is clocked at 985 KHz.
http://www.yqcomputer.com/
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Euphori » Thu, 06 Nov 2003 00:41:09


"Anders Carlsson" < XXXX@XXXXX.COM > a rit dans le message de


Well, due to the way the Oric was designed, one port of the VIA is shared by
the printer and by the sound generator (PSG)...
This is one of the most dubious design of the Oric: the PSG is not
memory-mapped, you access it through the VIA, with lots of operations in
order to handle the control lines of the PSG, and then the I/O port of the
PSG is in turn connected to the keyboard columns... Each time you want to
access a keyboard column, you spend a lot of clock cycles...


Yes, I was refering to the latest 6502 versions of Acorn Basic, that has
both high-level structures (control structures, procedures, etc.) and
in-line assembly...
Yet, twenty years ago, BBC Basic was already quite reknown...

Cheers,

Fabrice
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Anders Car » Thu, 06 Nov 2003 01:26:37

"Euphoric" < XXXX@XXXXX.COM > writes:


Yes, I've noticed this before when I was considering how much work it
would be to port one of my music players to Oric.


And me who thought the wiring together of joystick port 1 and keyboard
was bad enough on the C64.. :-)

--
Anders Carlsson

"Please not to close to the hair, finger, clothes to run about the
inside's vehicle, in order to prevent quilt involvement." -- Bit Racer
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Euphori » Thu, 06 Nov 2003 17:25:29


NyVpb.4453$ XXXX@XXXXX.COM ...
the

What do you mean, Steve ? Are you talking about a french translation of
Basic keywords (e.g "VA EN" instead of "GO TO" ?) ?
Was it a rom replacement or a cassette-loaded program ?

missing

Actually, it runs significantly slower...
The interpreter routine that fetches consecutive bytes is extended in order
to cope with file names used as commands and to differentiate those file
names with assignment variables, and this slows down the whole
interpretation process...

I'm considering extending my Evolution Basic to a semi-compiled form (don't
know if the 'semi' prefix has any english meaning :-)
This semi-compilation would mainly transform sequential accesses in direct
accesses (e.g variable access, line access in a goto or gosub) and still
keep a very compact tokenized form (so, still interpreted but about as fast
as Forth)...

Best regards,

Fabrice
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Simo » Fri, 07 Nov 2003 02:48:17


I think Steve was talking about Basic Francais, see
http://www.yqcomputer.com/

It was a cassette load, so it requested a part of the RAM, and was
rather useless IMO since you had to learn all the Basic words again !

Simon
 
 
 

To Anders : speed difference between Basic 1.0 and 1.1

Post by Euphori » Fri, 07 Nov 2003 03:01:54

"Anders Carlsson" < XXXX@XXXXX.COM > a rit dans le message de
news: XXXX@XXXXX.COM ...

I've re-run your tests on the Microtan-65, Oric-1 and Atmos...
Here they are for your collection :-)

BM1 BM2 BM3 BM4 BM5 BM6 BM7 BM8 Avg
--------------------------------------------------
BBC (B ?) 0.6 3.2 8.1 8.8 9.9 14.3 21.9 48 14.3
Acorn Atom 0.5 5.1 9.5 10.8 13.9 19.1 31.1 92 22.8
VIC-20 1.4 8.3 15.5 17.1 18.3 27.2 42.7 99 28.7
Apple II 1.3 8.5 16.0 17.8 19.1 28.6 44.8 107 30.4
Dragon 32 1.6 10.2 19.7 21.6 23.3 34.3 50.0 129 36.2
SVI-328 1.6 5.4 17.9 19.6 20.6 30.7 42.2 236 46.7
ZX81 (fast) 4.5 6.9 16.4 15.8 18.6 49.7 68.5 229 51.2
ZX Spectrum 4.8 8.7 21.1 20.4 24.0 55.3 80.7 253 58.5
Atari 600XL 2.2 7.2 19.1 22.8 25.8 37.6 58.3 412 73.1
TI-99/4A 2.9 8.8 22.8 24.5 26.1 61.6 84.4 382 76.6

Microtan65 1.9 12.8 24.7 27.8 29.6 43.2 68.9 243.0
Oric-1 1.8 17.1 29.0 31.4 38.0 51.8 77.8 230.1
Atmos 1.6 15.2 25.4 27.4 33.0 45.6 68.5 136.5

You can see that the results are the same you already provided for the Atmos
(I have used timers to have a more precise timing, this required additional
variables, so I have been cautious to initialize variables in the same order
you used them, and to provide the same amount of lines for the lookup
occuring in GOTOs and GOSUBs).
The only difference with your benchmarking is with BM8, because I've
replaced LOG by LN on the Oric-1 and Atmos (LOG is the decimal logarithm,
this requires an additional division :-)
Except that, I have strictly followed your syntax, even if FOR loops go
faster if you don't precise the index variable in the NEXT statement...

But, I'm not computing an average, because your average is a
"double-strange" average... :-)
I prefer to present your individual tests in this way:

BM1 measures the FOR loop
BM2 measures a simple incrementation and loop
BM3-BM2 measures standard arithmetics
BM4-BM3 roughly measures the cost of converting decimal numbers to float
binaries (Sinclair machines have a negative value here, because they store
the floating point value in the code)
BM5-BM4 measures GOSUBs
BM6-BM5 measures small FOR loops (ie. the initialization is very costly)
BM7-BM6 measures array access
BM8-BM2 measures transcendental functions

So, actually, BM7 alone is already a sort of average of BM2, BM3-BM2,
BM4-BM3, BM5-BM4, BM6-BM5 and BM7-BM6...

Anyway, I was interested in the Microtan-65 timings, because it really
represents the original Microsoft BASIC 65, from which the Oric Basics are
derived.
The Microtan-65 runs at 750 kHz only, below I'm providing timings of an
hypothetic 1 MHz Microtan to compare with the Oric Basics:

-----------------------------------------------------
BM1 :

1MHz Microtan 1.4
Oric-1 1.8
Atmos 1.6

comment: the inner interpreter loop of the Oric-1 introduces some new
features, not found on the original Basic-65:
- new command separators have been introduced (ELSE and the quote)
- Ctrl-C detection between two executed commands
- ability to CONTinue the program after a Ctrl-C (the TXTPTR is frequently
saved)
- tests for TRACEd execution (TRON, TROFF)
And of course also, the VIA timer interrupt that does a lot of handling,
including keyboard polling...