Skip to content

Commit 5a846c8

Browse files
committed
1 parent ebdac01 commit 5a846c8

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ n | xor mimic method method | FNx1 |FNx256 | x1 | x256 |
88
04 | (A-B)*(A-B) | 0.22 | 32.38 | 0.22 | 22.46 |
99
05 | ABS (A-B) | 0.24 | 29.60 | 0.20 | 19.56 |
1010
06 | NOT(A AND B) AND (A OR B) | 0.26 | 33.66 | 0.20 | 23.48 |
11+
07 | (NOT a <> NOT b) | 0.24 | 30.92 | 0.22 | 20.60 |
1112

1213
[live performance test data sheet](https://docs.google.com/spreadsheets/d/1gIcXWzl98PcUVWsTl_Q9AqaaVZWXGzfZoju-cEnj5f8/edit?usp=sharing)
1314

src/main/basic/xor07.bas

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# (C)FRANCO RONDINI 2017.
2+
#
3+
# title : xor07.bas
4+
# description : TESTING PERFORMANCE IN ZX SPECTRUM XOR METHODS
5+
# author : Franco Rondini (c) 2017
6+
# date : 20170923
7+
# version : 1.0.0
8+
# note : (NOT a <> NOT b)
9+
# : performs in 0.24 sec. x256: 30.54 sec.
10+
# ============================================================================
11+
2 CLS : PRINT TAB 5;"XOR TESTING: 07"
12+
3 PRINT " (NOT a <> NOT b) "
13+
4 PRINT "--------------------------------"
14+
5 DEF FN t()=((65536*PEEK 23674+256*PEEK 23673+ PEEK 23672)/50)
15+
7 DEF FN x(a,b)=(NOT a <> NOT b)
16+
9 LET t1=FN t()
17+
10 FOR a=0 TO 1 : REM left operand
18+
20 FOR b=0 TO 1 : REM right operand
19+
30 LET r=FN x(a,b) : REM compute xor
20+
40 PRINT "a:";a;" b:";b;" => ";r
21+
50 NEXT b
22+
60 NEXT a
23+
65 LET t2=FN t()
24+
69 PRINT "time taken in seconds:";t2-t1
25+
26+
100 FOR i=0 TO 255
27+
110 FOR a=0 TO 1 : REM left operand
28+
120 FOR b=0 TO 1 : REM right operand
29+
130 LET r=FN x(a,b) : REM compute xor
30+
150 NEXT b
31+
160 NEXT a
32+
165 NEXT i
33+
166 LET t3=FN t()
34+
169 PRINT "time taken for 4096 ..:";t3-t2

src/main/basic/xor07b.bas

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# (C)FRANCO RONDINI 2017.
2+
#
3+
# title : xor07b.bas
4+
# description : TESTING PERFORMANCE IN ZX SPECTRUM XOR METHODS
5+
# author : Franco Rondini (c) 2017
6+
# date : 20170923
7+
# version : 1.0.0
8+
# note : (NOT a <> NOT b)
9+
# : performs in 0.22 sec. x256: 20.60 sec.
10+
# ============================================================================
11+
2 CLS : PRINT TAB 5;"XOR TESTING: 07b"
12+
3 PRINT " (NOT a <> NOT b) ..without FN"
13+
4 PRINT "--------------------------------"
14+
5 DEF FN t()=((65536*PEEK 23674+256*PEEK 23673+ PEEK 23672)/50)
15+
7 REM DEF FN x(a,b)=((NOT a <> NOT b))
16+
9 LET t1=FN t()
17+
10 FOR a=0 TO 1 : REM left operand
18+
20 FOR b=0 TO 1 : REM right operand
19+
30 LET r=(NOT a <> NOT b) : REM compute xor
20+
40 PRINT "a:";a;" b:";b;" => ";r
21+
50 NEXT b
22+
60 NEXT a
23+
65 LET t2=FN t()
24+
69 PRINT "time taken in seconds:";t2-t1
25+
26+
100 FOR i=0 TO 255
27+
110 FOR a=0 TO 1 : REM left operand
28+
120 FOR b=0 TO 1 : REM right operand
29+
130 LET r=(NOT a <> NOT b) : REM compute xor
30+
150 NEXT b
31+
160 NEXT a
32+
165 NEXT i
33+
166 LET t3=FN t()
34+
169 PRINT "time taken for 4096 ..:";t3-t2

0 commit comments

Comments
 (0)