ENTERPRISE KLUB
2024. március 2.,  14-19 óráig
1074 Budapest, Károly krt. 3/A.
Részletek
Welcome, Guest. Please login or register.


Author Topic: 8-bit machines Basic performance (Read 13445 times)

Offline gflorez

  • EP addict
  • *
  • Posts: 3594
  • Country: es
    • Támogató Támogató
Re: 8-bit machines Basic performance
« Reply #15 on: 2023.February.06. 10:24:29 »
Herbert123, you should better make your tests on the up to date EP128emu.

Offline geco

  • EP addict
  • *
  • Posts: 7014
  • Country: hu
    • Támogató Támogató
Re: 8-bit machines Basic performance
« Reply #16 on: 2023.February.06. 11:35:11 »
For the answer try this test on various computers:
10 FOR I=1 TO 10 STEP 0.1
20 PRINT I
30 IF I=1.3 THEN STOP
40 NEXT I
I have tested it with a small modification which accepts all computers:
10 FOR I=1 TO 10 STEP 0.1
20 PRINT I
30 IF I=1.3 THEN GOTO 50
40 NEXT I
50 REM
Code: [Select]
Amstrad CPC    counts until 10
Commodore +4   counts until 10
Commodore 128  counts until 10
Commodore 64   counts until 10
Enterprise     counts until 1.3 ok
Videoton TVC   counts until 1.3 ok
ZX Spectrum    counts until 10

Offline geco

  • EP addict
  • *
  • Posts: 7014
  • Country: hu
    • Támogató Támogató
Re: 8-bit machines Basic performance
« Reply #17 on: 2023.February.06. 11:43:03 »
I tested Herbert's example on Videoton TVC also, it finished under 47 seconds. :D

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14685
  • Country: hu
    • http://enterprise.iko.hu/
Re: 8-bit machines Basic performance
« Reply #18 on: 2023.February.06. 14:38:35 »
Amstrad CPC    counts until 10
And print crazy values :lol:
[ Guests cannot view attachments ]

Offline ergoGnomik

  • EP addict
  • *
  • Posts: 1282
  • Country: hu
  • Stray cat from Commodore alley
Re: 8-bit machines Basic performance
« Reply #19 on: 2023.February.06. 18:11:46 »
And print crazy values :lol:
What makes those values crazy? :?:

Offline Trefe

  • User
  • *
  • Posts: 65
  • Country: hu
Re: 8-bit machines Basic performance
« Reply #20 on: 2023.February.06. 19:38:56 »
ENTERPRISE and TVC represent floating-point numbers on a BCD basis, while the more common Microsoft BASIC represents them on a binary basis. Since computer processors work in binary, they can process numbers represented in this way faster.
On the other hand, it is not possible, or hardly possible, to express decimal fractions exactly with binary numbers. That is also why, when I studied programming in high school, it was expressly forbidden to test the equality of two decimal fractions in conditional instructions.
In terms of accuracy, ENTERPRISE and TVC spoil us, but the calculation is slower.
Bruce Tanner also wrote about this in one of his posts during the creation of TVC BASIC.

I'm sorry, my knowledge of the English language is weak, I hope it can be understood with google translator.

Trefe

.....

Az ENTERPRISE és a TVC BCD alapon ábrázolják a lebegőpontos számokat, míg az elterjedtebb Microsoft BASIC pedig binárisan. Mivel a számítógépek processzorai binárisan működnek, ezért az így ábrázolt számokat gyorsabban fel tudják dolgozni.
Viszont bináris számokkal pontosan kifejezni a tizedes törteket nem, vagy alig lehet. Ezért is volt annak idején, mikor programozást tanultam a középiskolában, hogy kifejezetten tiltották két tizedes törtszám egyenlőségének vizsgálatát a feltételes utasításokban.
Pontosság szempontjából az ENTERPRISE és a TVC elkényeztet minket, viszont lassabb a számolás.
Erről írt is valamelyik posztjában Bruce Tanner a TVC BASIC készítésénél.

Sanálom, az angol nyelv tudásom gyenge, remélem google translatorral is érthető.

Trefe


Offline Herbert123

  • Newbie
  • Posts: 10
  • Country: ca
Re: 8-bit machines Basic performance
« Reply #21 on: 2023.February.06. 19:46:42 »
@Trefe You posted while I was writing this ;-)

Ah, floating-point imprecision causes rounding errors. Am I correct in stating that the Enterprise's basic is using a limited-precision decimal then? Which slows down calculations?

Offline gflorez

  • EP addict
  • *
  • Posts: 3594
  • Country: es
    • Támogató Támogató
Re: 8-bit machines Basic performance
« Reply #22 on: 2023.February.06. 20:02:43 »
It is more the contrary... the EP uses correct precision on BCD, while Microsoft uses an approximation.

The more accurate calculation makes the EP slower.

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14685
  • Country: hu
    • http://enterprise.iko.hu/
Re: 8-bit machines Basic performance
« Reply #23 on: 2023.February.06. 20:10:23 »
The more accurate calculation makes the EP slower.
But more usable for math calculations! EP have a 10 BCD digit. At my school time available calculators only have a 8 digit.

Offline Herbert123

  • Newbie
  • Posts: 10
  • Country: ca
Re: 8-bit machines Basic performance
« Reply #24 on: 2023.February.06. 20:33:18 »
But more usable for math calculations! EP have a 10 BCD digit. At my school time available calculators only have a 8 digit.

...which also affects (slows down) the compiled versions...

Would be nice if Enterprise basic had a way to limit that precision for improved performance.

Offline ergoGnomik

  • EP addict
  • *
  • Posts: 1282
  • Country: hu
  • Stray cat from Commodore alley
Re: 8-bit machines Basic performance
« Reply #25 on: 2023.February.06. 20:39:48 »
There you go. :D
[ Guests cannot view attachments ]

Offline geco

  • EP addict
  • *
  • Posts: 7014
  • Country: hu
    • Támogató Támogató
Re: 8-bit machines Basic performance
« Reply #26 on: 2023.February.06. 21:37:11 »
...which also affects (slows down) the compiled versions...
Compiled version does not slow down (if you mean ZZZIP compiler) it works only with integers and if i remember well from -32768 to 32767.
« Last Edit: 2023.February.07. 11:45:25 by szipucsu »

Offline BruceTanner

  • EP lover
  • *
  • Posts: 607
  • Country: gb
Re: 8-bit machines Basic performance
« Reply #27 on: 2023.February.06. 22:56:18 »
IS-BASIC also "cheats" if both numbers in an operation are 16 bit integers. FOR I=1 TO 1000 STEP 0.1 is slower than FOR I=1 TO 10000 STEP 1. But the overhead of checking for everything being 16 bit integers, converting integers to floating point when they are not, and deaing with 16 bit result overflow, means it is still not as fast as you would like :oops: (and I can't remember if TVC has this!)

Offline Trefe

  • User
  • *
  • Posts: 65
  • Country: hu
Re: 8-bit machines Basic performance
« Reply #28 on: 2023.February.07. 06:13:57 »
But more usable for math calculations! EP have a 10 BCD digit. At my school time available calculators only have a 8 digit.

In addition, EP uses 12 digits for internal calculations. It only gives us a value rounded to 10 digits. (see EXOS ROM 0/1 disassembly, RST10 routines and table of internal constants.)

Trefe

Offline geco

  • EP addict
  • *
  • Posts: 7014
  • Country: hu
    • Támogató Támogató
Re: 8-bit machines Basic performance
« Reply #29 on: 2023.February.07. 09:10:58 »
IS-BASIC also "cheats" if both numbers in an operation are 16 bit integers. FOR I=1 TO 1000 STEP 0.1 is slower than FOR I=1 TO 10000 STEP 1. But the overhead of checking for everything being 16 bit integers, converting integers to floating point when they are not, and deaing with 16 bit result overflow, means it is still not as fast as you would like :oops: (and I can't remember if TVC has this!)
Regarding TVC, Zozo's test was running much faster on TVC until the screen should not be scrolled, did you perform optimalization in TVC Basic in calculation, or the reason is simpler OS, and can reach routines faster on TVC?