Comparison QB64 compiled with gcc optimizations and without
#29
here is another very simple code that copies a test file of about 4 mo to an array and copies the data randomly to another array.

you need a text file of about 4 MB to test. i found the test file in the compressed archive Common Resource Files on this forum. you can find it here :

https://staging.qb64phoenix.com/showthread.php?tid=327

program compiled with qb64 -O3

4.4x seconds : Read file and copy to table
7.1x seconds : Copy data randomly into another table.

program compiled with original qb64

5.9x seconds : Read file and copy to table
27.4x seconds : Copy data randomly into another table.

Code: (Select All)
$Console
Screen 0
Open "370099 Word List.txt" For Input As #1
Color 7: Print "Wait..."
compt = 0
start = Timer(.001)
chaine$ = ""
While EOF(1) = 0
    Line Input #1, chaine$
    compt = compt + 1
Wend
Color 2
Print: Print " "; compt; " : Number of lines in the file."
Seek #1, 1
chaine$ = "": compt2 = 0: Dim tab$(compt)
While EOF(1) = 0
    Line Input #1, chaine$
    compt2 = compt2 + 1
    tab$(compt2) = chaine$
Wend
Color 3
Print: Print " "; Timer(.001) - start; "seconds : Read file and copy to table."
Close #1
Dim tab2$(compt)
Randomize Timer
start = Timer(.001)
For i = 1 To compt
    tab2$(i) = tab$(Rnd * compt)
Next i
Color 2
Print: Print " "; Timer(.001) - start; "seconds : Copy data randomly into another table."
Color 7
End
Reply


Messages In This Thread
RE: Comparison QB64 compiled with Ofast and without - by Coolman - 05-11-2022, 04:25 PM



Users browsing this thread: 28 Guest(s)