-
Notifications
You must be signed in to change notification settings - Fork 20
/
iospeed.bas
83 lines (73 loc) · 1.06 KB
/
iospeed.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
' Test speed of block I/O versus
' line oriented I/O.
' Get free memory
DIM A(0) byte
max = FRE()
? "---------------"
? "Memory:", max
' Test BGET speed:
? "--- Read with BGET --"
? "Err:",
st = TIME
OPEN #1, 4, 0, "D:CARRERA3.BAS"
? ERR(),
BGET #1, ADR(A), max
? ERR(),
total = DPEEK($358)
CLOSE #1
? ERR()
? "Read:", total
' Count lines!
ptr = ADR(A)
pend = ptr + total
lines = 0
WHILE ptr < pend
IF PEEK(ptr) = $9b
INC lines
ENDIF
INC ptr
WEND
et = TIME
? "Lines:", lines
? "Time:", et-st
' Test INPUT speed:
line$ = ""
lines = 0
? "--- Read with INPUT --"
? "Err:",
st = TIME
OPEN #1, 4, 0, "D:CARRERA3.BAS"
? ERR(),
WHILE ERR() < 128
INPUT #1, line$
INC lines
WEND
? ERR(),
CLOSE #1
? ERR()
et = TIME
? "Lines:", lines
? "Time:", et-st
' Test GET speed:
? "--- Read with GET --"
? "Err:",
st = TIME
OPEN #1, 4, 0, "D:CARRERA3.BAS"
? ERR(),
' Count lines while reading
total = 0
lines = 0
WHILE ERR() < 128
GET #1, x
IF x = $9b
INC lines
ENDIF
INC total
WEND
? ERR(),
CLOSE #1
? ERR()
et = TIME
? "Read:", total
? "Lines:", lines
? "Time:", et-st