Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comparison QB64 compiled with gcc optimizations and without
#27
here is a very simple code that opens a text file of about 4 mo to read it line by line three times in a row with the use of Left$ InStr. the speed gain is not very important but it is always better with qb64 compiled with the -O3 option.

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://qb64phoenix.com/forum/showthread.php?tid=327

6.5x seconds : program compiled with qb64 -O3
7.2x seconds : program compiled with original qb64

Conclusion : disk accesses don't advantage much the version of qb64 compiled with the -O3 option. don't forget that modern operating systems use a disk cache in memory, which can distort the results.

Code: (Select All)
$Console
Screen 0
chaine$ = "": chaine2$ = ""
Open "370099 Word List.txt" For Input As #1
start = Timer(.001)
Color 7: Print "Wait..."
While EOF(1) = 0
    Line Input #1, chaine$
    chaine2$ = chaine$
Wend
Seek #1, 1
While EOF(1) = 0
    Line Input #1, chaine$
    If Left$(chaine$, 1) = "b" Then
        chaine2$ = chaine$
    End If
Wend
Seek #1, 1
While EOF(1) = 0
    Line Input #1, chaine$
    If InStr(1, chaine$, "oun") > 0 Then
        chaine2$ = chaine$
    End If
Wend
Color 3
Print: Print Timer(.001) - start; "seconds"
Color 7
Close #1
End
Reply


Messages In This Thread
RE: Comparison QB64 compiled with Ofast and without - by Coolman - 05-10-2022, 02:33 PM



Users browsing this thread: 45 Guest(s)