Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: Nice fractals

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,782
    Rep Power
    10

    Nice fractals

    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    159

    Re: Nice fractals

    Try this

    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  3. #3
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Nice fractals

    Thanks nice link and program. Fractals are amazing and always fun to look at!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,782
    Rep Power
    10

    Re: Nice fractals

    Thanks Abraxas.
    Those kind of scripts shows the limit in interpreted languages.
    I will use it to study more tricks to add more execution speed.

    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Nice fractals

    Nice fractals!,

    Mandelbrot is good, I tried to optimize Abraxas code a bit, but I got only 20% increase
    [code=thinbasic]
    SUB DoBRot()
    local t1, t2 as long
    local wminone as long = width - 1
    local hminone as long = height - 1

    TBGL_BeginPoly %GL_POINTS
    xmin = -2.0
    ymin = -1.3
    xmax = 1.0
    ymax = 1.3
    integralX = (xmax - xmin) / width
    integralY = (ymax - ymin) / height
    x = xmin
    For S = 1 To wminone
    y = ymin
    For Z = 1 To hminone
    x1 = 0
    y1 = 0
    looper = 0
    While (looper < 1000 And Sqr( x1*x1 + y1*y1 ) < 2)
    Looper += 10
    xx = x1*x1 - y1*y1 + x
    y1 = 2*x1*y1 + y
    x1 = xx
    WEND
    TBGL_Color ColorMap_R(Looper), ColorMap_G(looper), ColorMap_B(looper)
    TBGL_Vertex s,z
    y += integralY
    Next
    x += integralX
    Next
    TBGL_EndPOLY
    END SUB
    [/code]

    I just put tbgl_BeginPoly/tbgl_EndPoly out of the loops as it is not necessary for each point, added += on two places, removed () where not needed. I am sure it could be speeded up even more somehow, but I am don't how to do it


    Bye,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Nice fractals

    Ok,

    here is version which should run 47% faster - using FOR/NEXT with step !
    [code=thinbasic]
    SUB DoBRot()
    local t1, t2 as long
    local wminone as long = width - 1
    local hminone as long = height - 1

    TBGL_BeginPoly %GL_POINTS
    xmin = -2.0
    ymin = -1.3
    xmax = 1.0
    ymax = 1.3
    integralX = (xmax - xmin) / width
    integralY = (ymax - ymin) / height
    x = xmin
    For S = 1 To wminone
    y = ymin
    For Z = 1 To hminone
    x1 = 0
    y1 = 0
    for looper = 0 to 1000 step 10
    if Sqr( x1*x1 + y1*y1 ) >= 2 then exit for
    xx = x1*x1 - y1*y1 + x
    y1 = 2*x1*y1 + y
    x1 = xx
    next
    TBGL_Color ColorMap_R(Looper), ColorMap_G(looper), ColorMap_B(looper)
    TBGL_Vertex s,z
    y += integralY
    Next
    x += integralX
    Next
    TBGL_EndPOLY
    END SUB
    [/code]


    Bye,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  7. #7
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    159

    Re: Nice fractals

    thanks Petr.

    Ive added some different sub routines to give you timing examples.

    DoBrot1() '= 14.5 seconds
    DoBrot2() '= 14.2 seconds
    DoBrot3() '= 11.2 seconds
    DoBrot4() '= 14.0 seconds

    how does it compare on your machine?



    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  8. #8
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,782
    Rep Power
    10

    Re: Nice fractals

    Similar time here:
    1: 12,6
    2: 14,2
    3: 10,3
    4: 12,7

    A great example to be used to make optimization.

    Thanks a lot
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  9. #9
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Nice fractals

    Hi,

    grr, worst results
    CPU is AMD Sempron 64 3400+ ( 1.8GHz real freq )

    • 18.68
    • 18.03
    • 14.77
    • 18.33


    Really nice benchmark!

    Bye,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,782
    Rep Power
    10

    Re: Nice fractals

    The biggest time is loosed in
    [code=thinbasic]
    While (lo < 1000 And Sqr( x1 * x1) + (y1 * y1) < 2)
    Lo += 10 ' the loop counter
    xx = x1 * x1 - y1 * y1 + x
    y1 = 2 * x1 * y1 + y
    x1 = xx
    incr counter
    WEND
    [/code]
    Commentig out the full WHILE/WEND it takes just half second.

    I've added a counter to be able to check how many times it is executed that while.
    In DoBRot1 WHILE/WEND is executed 3.729.844 times. A lot for an interpreter but I'm sure I will get some more optimization.

    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Page 1 of 3 123 LastLast

Similar Threads

  1. Travel into 3D fractals
    By Charles Pegge in forum Shout Box Area
    Replies: 2
    Last Post: 15-06-2011, 08:40

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •