jörg
23.02.2004, 03:17
Kennt jemand die Geschwindigkeit von CCBASIC? Gibt's da eine Tabelle?
Ich suche nicht die Geschwindigkeit für jeden möglichen CCBAISC token unter allen denkbaren Umständen und ganz genau. Mir geht's mehr um einen Überblick.
Ich hab mal versucht, auf die Schnelle das auszutesten; aber jetzt ist's schon so spät und ich hab immer noch nicht alles drin, und ich hab's auch noch nicht ausgewert.
Ich füge hier mal mein Testprogramm ein (upload geht momentan bei mir nicht). Das Programm sollte auf jeder CC1 laufen; es braucht keinen S19-Treiber, sondern nur ein ASCII Terminal an der RS232.
Bin in einer Woche zurück -- vielleicht kann jemand was dazu sagen!
'-----------------------------------
' CCBASIC Performance Messungen
' V1.0, 2004-02-23 / JF
' Es werden keine S19 Treiber benötigt,
' die Ausgabe erfolgt über RS232 an ein ASCII Terminal
'-----------------------------------
define lbyte byte[1]
define delta word[4] ' delta timer
define base word[5] ' timer for empty loop
define i word[6] ' counter
define temp word[7] ' GP
define j word[8] ' GP
define k word[9] ' GP
'########## start
beep 368,10,0 : pause 50
print "Start CCBASIC performance tests, 2004-02-23 / JF"
print "All lines are <text>TAB<value>"
print "All values are [ms] per 1000 iterations"
'########## get base: empty loop
delta = timer
for i = 1 to 1000
next i
delta = timer - delta
base = delta
print "empty loop:", delta * 20
'########## measurements
gosub test_for
gosub test_assignment
gosub test_gosub
gosub test_sys
gosub test_if
'########## show end
print "Done CCBASIC performance tests."
beep 368,10,0 : pause 50
beep 368,10,0 : pause 50
end
'########## test cases
'########## test cases
'########## test cases
#test_if
delta = timer : for i = 1 to 1000
if i = 0 then temp = i
next i
delta = timer - delta - base : print "if i = 0 then temp = i", delta * 20
delta = timer : for i = 1 to 1000
if i <> 0 then temp = i
next i
delta = timer - delta - base : print "if i <> 0 then temp = i", delta * 20
delta = timer : for i = 1 to 1000
if i = 0 then temp = i else temp = i
next i
delta = timer - delta - base : print "if i = 0 then temp = i else temp = i", delta * 20
delta = timer : for i = 1 to 1000
temp = i : if i = 0 then temp = i
next i
delta = timer - delta - base : print "temp = i : if i = 0 then temp = i", delta * 20
delta = timer : for i = 1 to 1000
temp = i : if i <> 0 then temp = i
next i
delta = timer - delta - base : print "temp = i : if i <> 0 then temp = i", delta * 20
delta = timer : for i = 1 to 1000
if i <> 0 then temp = i else temp = i
next i
delta = timer - delta - base : print "if i <> 0 then temp = i else temp = i", delta * 20
delta = timer : for i = 1 to 1000
if i = 0 then goto goto_never
next i
delta = timer - delta - base : print "if i = 0 then goto goto_never", delta * 20
delta = timer : for i = 1 to 1000
if i <> 0 then goto goto_1
#goto_1
next i
delta = timer - delta - base : print "if i <> 0 then goto goto_1", delta * 20
delta = timer : for i = 1 to 1000
if i = 0 then goto goto_never else goto goto_2
#goto_2
next i
delta = timer - delta - base : print "if i = 0 then goto goto_never else goto goto_2", delta * 20
delta = timer : for i = 1 to 1000
if i <> 0 then goto goto_3 else goto goto_never
#goto_3
next i
delta = timer - delta - base : print "if i <> 0 then goto goto_3 else goto goto_never", delta * 20
return
#goto_never
print "reached goto_never!!"
beep 368,10,0 : pause 50
beep 368,10,0 : pause 50
beep 368,10,0 : pause 50
beep 368,10,0 : pause 50
end
#test_sys
delta = timer : for i = 1 to 1000
sys &h91 &h819d
next i
delta = timer - delta - base : print "sys rts_push1", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push2", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push3", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h0, &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push4", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h0, &h0, &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push5", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h0, &h0, &h0, &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push6", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h0, &h0, &h0, &h0, &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push7", delta * 20
delta = timer : for i = 1 to 1000
temp = sys_rts_push7
next i
delta = timer - delta - base : print "sys_rts_push7", delta * 20
return
#sys_rts_push7
sys &h91 &h0, &h0, &h0, &h0, &h0, &h0, &h819d
return
#test_gosub
delta = timer : for i = 1 to 1000
gosub gosub_empty
next i
delta = timer - delta - base : print "gosub gosub_empty", delta * 20
delta = timer : for i = 1 to 1000
temp = gosub_empty_return
next i
delta = timer - delta - base : print "temp = gosub_empty_return", delta * 20
delta = timer : for i = 1 to 1000
gosub gosub_word_word
next i
delta = timer - delta - base : print "gosub gosub_word_word", delta * 20
delta = timer : for i = 1 to 1000
temp = gosub_word_word_return
next i
delta = timer - delta - base : print "temp = gosub_word_word_return", delta * 20
return
#gosub_empty
return
#gosub_empty_return
return 123
#gosub_word_word
temp = temp
return
#gosub_word_word_return
temp = temp
return temp
#test_assignment
delta = timer : for i = 1 to 1000
temp = temp
next i
delta = timer - delta - base : print "word = word", delta * 20
delta = timer : for i = 1 to 1000
lbyte = lbyte
next i
delta = timer - delta - base : print "byte = byte", delta * 20
delta = timer : for i = 1 to 1000
temp = lbyte
next i
delta = timer - delta - base : print "word = byte", delta * 20
delta = timer : for i = 1 to 1000
lbyte = temp
next i
delta = timer - delta - base : print "byte = word", delta * 20
return
#test_for
' test empty loops running from 1..10
for k = 1 to 10
delta = timer
for i = 1 to 1000
for j = 1 to k
next j
next i
delta = timer - delta - base : print "for j = 1 to "; k; " : next j", delta * 20
next k
return
Ich suche nicht die Geschwindigkeit für jeden möglichen CCBAISC token unter allen denkbaren Umständen und ganz genau. Mir geht's mehr um einen Überblick.
Ich hab mal versucht, auf die Schnelle das auszutesten; aber jetzt ist's schon so spät und ich hab immer noch nicht alles drin, und ich hab's auch noch nicht ausgewert.
Ich füge hier mal mein Testprogramm ein (upload geht momentan bei mir nicht). Das Programm sollte auf jeder CC1 laufen; es braucht keinen S19-Treiber, sondern nur ein ASCII Terminal an der RS232.
Bin in einer Woche zurück -- vielleicht kann jemand was dazu sagen!
'-----------------------------------
' CCBASIC Performance Messungen
' V1.0, 2004-02-23 / JF
' Es werden keine S19 Treiber benötigt,
' die Ausgabe erfolgt über RS232 an ein ASCII Terminal
'-----------------------------------
define lbyte byte[1]
define delta word[4] ' delta timer
define base word[5] ' timer for empty loop
define i word[6] ' counter
define temp word[7] ' GP
define j word[8] ' GP
define k word[9] ' GP
'########## start
beep 368,10,0 : pause 50
print "Start CCBASIC performance tests, 2004-02-23 / JF"
print "All lines are <text>TAB<value>"
print "All values are [ms] per 1000 iterations"
'########## get base: empty loop
delta = timer
for i = 1 to 1000
next i
delta = timer - delta
base = delta
print "empty loop:", delta * 20
'########## measurements
gosub test_for
gosub test_assignment
gosub test_gosub
gosub test_sys
gosub test_if
'########## show end
print "Done CCBASIC performance tests."
beep 368,10,0 : pause 50
beep 368,10,0 : pause 50
end
'########## test cases
'########## test cases
'########## test cases
#test_if
delta = timer : for i = 1 to 1000
if i = 0 then temp = i
next i
delta = timer - delta - base : print "if i = 0 then temp = i", delta * 20
delta = timer : for i = 1 to 1000
if i <> 0 then temp = i
next i
delta = timer - delta - base : print "if i <> 0 then temp = i", delta * 20
delta = timer : for i = 1 to 1000
if i = 0 then temp = i else temp = i
next i
delta = timer - delta - base : print "if i = 0 then temp = i else temp = i", delta * 20
delta = timer : for i = 1 to 1000
temp = i : if i = 0 then temp = i
next i
delta = timer - delta - base : print "temp = i : if i = 0 then temp = i", delta * 20
delta = timer : for i = 1 to 1000
temp = i : if i <> 0 then temp = i
next i
delta = timer - delta - base : print "temp = i : if i <> 0 then temp = i", delta * 20
delta = timer : for i = 1 to 1000
if i <> 0 then temp = i else temp = i
next i
delta = timer - delta - base : print "if i <> 0 then temp = i else temp = i", delta * 20
delta = timer : for i = 1 to 1000
if i = 0 then goto goto_never
next i
delta = timer - delta - base : print "if i = 0 then goto goto_never", delta * 20
delta = timer : for i = 1 to 1000
if i <> 0 then goto goto_1
#goto_1
next i
delta = timer - delta - base : print "if i <> 0 then goto goto_1", delta * 20
delta = timer : for i = 1 to 1000
if i = 0 then goto goto_never else goto goto_2
#goto_2
next i
delta = timer - delta - base : print "if i = 0 then goto goto_never else goto goto_2", delta * 20
delta = timer : for i = 1 to 1000
if i <> 0 then goto goto_3 else goto goto_never
#goto_3
next i
delta = timer - delta - base : print "if i <> 0 then goto goto_3 else goto goto_never", delta * 20
return
#goto_never
print "reached goto_never!!"
beep 368,10,0 : pause 50
beep 368,10,0 : pause 50
beep 368,10,0 : pause 50
beep 368,10,0 : pause 50
end
#test_sys
delta = timer : for i = 1 to 1000
sys &h91 &h819d
next i
delta = timer - delta - base : print "sys rts_push1", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push2", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push3", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h0, &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push4", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h0, &h0, &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push5", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h0, &h0, &h0, &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push6", delta * 20
delta = timer : for i = 1 to 1000
sys &h91 &h0, &h0, &h0, &h0, &h0, &h0, &h819d
next i
delta = timer - delta - base : print "sys rts_push7", delta * 20
delta = timer : for i = 1 to 1000
temp = sys_rts_push7
next i
delta = timer - delta - base : print "sys_rts_push7", delta * 20
return
#sys_rts_push7
sys &h91 &h0, &h0, &h0, &h0, &h0, &h0, &h819d
return
#test_gosub
delta = timer : for i = 1 to 1000
gosub gosub_empty
next i
delta = timer - delta - base : print "gosub gosub_empty", delta * 20
delta = timer : for i = 1 to 1000
temp = gosub_empty_return
next i
delta = timer - delta - base : print "temp = gosub_empty_return", delta * 20
delta = timer : for i = 1 to 1000
gosub gosub_word_word
next i
delta = timer - delta - base : print "gosub gosub_word_word", delta * 20
delta = timer : for i = 1 to 1000
temp = gosub_word_word_return
next i
delta = timer - delta - base : print "temp = gosub_word_word_return", delta * 20
return
#gosub_empty
return
#gosub_empty_return
return 123
#gosub_word_word
temp = temp
return
#gosub_word_word_return
temp = temp
return temp
#test_assignment
delta = timer : for i = 1 to 1000
temp = temp
next i
delta = timer - delta - base : print "word = word", delta * 20
delta = timer : for i = 1 to 1000
lbyte = lbyte
next i
delta = timer - delta - base : print "byte = byte", delta * 20
delta = timer : for i = 1 to 1000
temp = lbyte
next i
delta = timer - delta - base : print "word = byte", delta * 20
delta = timer : for i = 1 to 1000
lbyte = temp
next i
delta = timer - delta - base : print "byte = word", delta * 20
return
#test_for
' test empty loops running from 1..10
for k = 1 to 10
delta = timer
for i = 1 to 1000
for j = 1 to k
next j
next i
delta = timer - delta - base : print "for j = 1 to "; k; " : next j", delta * 20
next k
return