Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comparison QB64 compiled with gcc optimizations and without
#2
Fractal Tree : I got this code from the site rosettacode.

4.1x seconds : program compiled with qb64 -Ofast
6.1x seconds : program compiled with original qb64

it seems that there is an interesting gain when graphic commands like pset or line are used.

Code: (Select All)
_Title "Fractal Tree"
Const sw% = 640
Const sh% = 480

Screen _NewImage(sw, sh, 8)
_Delay 0.2
_ScreenMove _Middle

start = Timer(.001)
For i% = 1 To 1000
    Color (Rnd * 15)
    Call tree(sw \ 2, sh - 10, _Pi * 1.5, _Pi / 180 * 29, 112, 15)
Next i%
Print Timer(.001) - start; "seconds"
Sleep
System

Sub tree (x As Integer, y As Integer, initAngle As Double, theta As Double, length As Double, depth As Integer)
    Dim As Integer iL, newX, newY, iX, iY, iD
    iL = length: iX = x: iY = y: iD = depth
    newX = Cos(initAngle) * length + iX
    newY = Sin(initAngle) * length + iY
    Line (iX, iY)-(newX, newY)
    iL = length * .78
    iD = iD - 1
    If iD > 0 Then
        Call tree(newX, newY, initAngle - theta, theta, iL, iD)
        Call tree(newX, newY, initAngle + theta, theta, iL, iD)
    End If
End Sub
Reply


Messages In This Thread
RE: Comparison QB64 compiled with Ofast and without - by Coolman - 05-07-2022, 09:16 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  niXman gcc-13.1.0 Jack 8 1,866 10-04-2023, 12:51 PM
Last Post: a740g
  BASIC's Comparison Matrix: ideas for content? CharlieJV 28 6,762 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 831 06-02-2022, 06:27 PM
Last Post: Coolman

Forum Jump:


Users browsing this thread: 1 Guest(s)