1
QB64 Discussion / QB64 File I/O speeds compared to QB are really slow
« on: March 17, 2020, 12:29:32 pm »
Apologies i must have pressed post halfway through typing
I have just been testing some programs that were originally written in VBDOS (Never used the GUI stuff)
I got the programs running without problems except that the speed was much slower.
One section that very marked difference was taking about 4 seconds (VBDOS) and in QB64 over 65 seconds.
After further investigation it was apparent that the time differences were taking place during file i/o.
The programs are used for nesting different components on sheets, and then generating the Laser CNC cutting programs.
It is during the generation of these CNC programs , there is a lot of file i/o reading and writing of text files.
I then wrote a small program to see the differences between QB, VBDOS and QB64 , the results are significant.
The program creates 100,000 LINES OF CSV data ( 5 data items , ie 4 commas), using the Print #, Write #, functions
The program then reads back the data
Using Input #, and then Line Input # functions
In the QB64 test , i have used the Line input # (Binary mode) it is not available in QB and VBDOS
The times shown are in seconds
Task QB VBDOS QB64 VB5
Print # 1.76 1.76 12.14 0.89
Write # 1.71 1.80 7.74 0.89
Input # 0.37 0.26 42.47 0.25
Line Input # 0.21 0.17 42.47 0.19
Binary Line Input# N/A N/A 1.37 N/A
The program uses a directory of C:\dave
SO if you are testing it, you will need to create that directory or change to different one.
If you want to the Binary Line Input , you need to set testbinio% = 1
I am thinking that there may be something wrong with my installtion, but before i reinstall again.
Has anybody else experienced with slow i/o performance, or is this just how it is.
I have just been testing some programs that were originally written in VBDOS (Never used the GUI stuff)
I got the programs running without problems except that the speed was much slower.
One section that very marked difference was taking about 4 seconds (VBDOS) and in QB64 over 65 seconds.
After further investigation it was apparent that the time differences were taking place during file i/o.
The programs are used for nesting different components on sheets, and then generating the Laser CNC cutting programs.
It is during the generation of these CNC programs , there is a lot of file i/o reading and writing of text files.
I then wrote a small program to see the differences between QB, VBDOS and QB64 , the results are significant.
The program creates 100,000 LINES OF CSV data ( 5 data items , ie 4 commas), using the Print #, Write #, functions
The program then reads back the data
Using Input #, and then Line Input # functions
In the QB64 test , i have used the Line input # (Binary mode) it is not available in QB and VBDOS
The times shown are in seconds
Task QB VBDOS QB64 VB5
Print # 1.76 1.76 12.14 0.89
Write # 1.71 1.80 7.74 0.89
Input # 0.37 0.26 42.47 0.25
Line Input # 0.21 0.17 42.47 0.19
Binary Line Input# N/A N/A 1.37 N/A
The program uses a directory of C:\dave
SO if you are testing it, you will need to create that directory or change to different one.
If you want to the Binary Line Input , you need to set testbinio% = 1
I am thinking that there may be something wrong with my installtion, but before i reinstall again.
Has anybody else experienced with slow i/o performance, or is this just how it is.
Code: QB64: [Select]
- sttimer = TIMER
- doprttest% = 1
- datastr$(1) = "Data_p1_" + formalt$((i&), "0")
- datastr$(2) = "Data_p2_" + formalt$((i&), "0")
- datastr$(3) = "Data_p3_" + formalt$((i&), "0")
- datastr$(4) = "Data_p4_" + formalt$((i&), "0")
- datastr$(5) = "Data_p5_" + formalt$((i&), "0")
- CLOSE #1
- fitimer = TIMER
- timetaken = fitimer - sttimer
- sttimer = TIMER
- datastr$(1) = "Data_p1_" + formalt$((i&), "0")
- datastr$(2) = "Data_p2_" + formalt$((i&), "0")
- datastr$(3) = "Data_p3_" + formalt$((i&), "0")
- datastr$(4) = "Data_p4_" + formalt$((i&), "0")
- datastr$(5) = "Data_p5_" + formalt$((i&), "0")
- CLOSE #1
- fitimer = TIMER
- timetaken = fitimer - sttimer
- sttimer = TIMER
- linecount& = 0
- linecount& = linecount& + 1
- CLOSE #1
- fitimer = TIMER
- timetaken = fitimer - sttimer
- PRINT "linecount&="; linecount&
- sttimer = TIMER
- linecount& = 0
- linecount& = linecount& + 1
- parsedata% = 0
- stpos% = 0
- Index% = 1
- Index% = Index% + 1
- stpos% = nextpos%
- 'FOR dli% = 1 TO 5
- ' PRINT datastr$(dli%)
- 'NEXT
- 'INPUT s$
- CLOSE #1
- fitimer = TIMER
- timetaken = fitimer - sttimer
- PRINT "linecount&="; linecount&
- testbinio% = 0
- sttimer = TIMER
- 'PRINT "loffile&="; loffile&
- linecount& = 0
- 'IF SEEK(1) < loffile& THEN
- 'PRINT "Length of data="; LEN(tdata$); "Current file pos="; SEEK(1)
- linecount& = linecount& + 1
- 'PRINT "Current file pos="; SEEK(1)
- CLOSE #1
- fitimer = TIMER
- timetaken = fitimer - sttimer
- PRINT "linecount&="; linecount&
- PRINT "press any key to continue"
- a$ = INKEY$
- 'PRINT "called ("; num; ","; precstr$; ")"
- tnum = num
- leadingzeros% = dotpos% - 1
- 'PRINT dotpos%, trailingzeros%
- multiplyby& = 10 ^ trailingzeros%
- 'PRINT tnumstr$, tempnum&
- addleadingzero$ = ""
- newleadingnumstr$ = addleadingzero$ + newleadingnumstr$
- tnumstr$ = newleadingnumstr$ + "." + newtrailingpartnumstr$
- trailingzeros% = 0
- addleadingzero$ = ""
- tnumstr$ = addleadingzero$ + tnumstr$
- 'PRINT tnumstr$
- formalt$ = tnumstr$