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

Possibly Related Threads…
Thread Author Replies Views Last Post
  niXman gcc-13.1.0 Jack 8 1,867 10-04-2023, 12:51 PM
Last Post: a740g
  BASIC's Comparison Matrix: ideas for content? CharlieJV 28 6,765 10-03-2022, 01:27 AM
Last Post: CharlieJV
  String comparison oddity...[SOLVED] Pete 6 1,304 08-05-2022, 07:16 PM
Last Post: Pete
  Found a BUG with the QB64 editor compiled with the -O3 option Coolman 2 834 06-02-2022, 06:27 PM
Last Post: Coolman

Forum Jump:


Users browsing this thread: 1 Guest(s)