Script zu langsam

  • Hallo,

    gibt es eine Möglichkeit dieses Script etwas zu beschleunigen?
    Es ist ein Script, was einen Mandelbrot fraktal anzeigt.


    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("lokster's Mandelbrot Set example", 750, 750)
    GUISetState(@SW_SHOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Bye")

    [/autoit] [autoit][/autoit] [autoit]

    $user32 = DllOpen("user32.dll")
    $gdi32 = DllOpen("gdi32.dll")

    [/autoit] [autoit][/autoit] [autoit]

    Mandelbrot()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(100)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Bye()
    Exit
    EndFunc ;==>Bye

    [/autoit] [autoit][/autoit] [autoit]

    Func pix($dc, $x, $y, $color)
    DllCall($gdi32, "long", "SetPixel", "long", $dc, "long", $x, "long", $y, "long", $color)
    EndFunc ;==>pix

    [/autoit] [autoit][/autoit] [autoit]

    Func GetDC($handle)
    $dc = DllCall($user32, "int", "GetDC", "hwnd", $handle)
    Return $dc[0]
    EndFunc ;==>GetDC

    [/autoit] [autoit][/autoit] [autoit]

    Func Mandelbrot()
    $dc = GetDC(WinGetHandle($Form1))

    [/autoit] [autoit][/autoit] [autoit]

    $width = 750
    $height = 750
    $maxiteration = 50 ; Die Schärfe

    [/autoit] [autoit][/autoit] [autoit]

    For $py = 0 To $height Step 1
    For $px = 0 To $width Step 1
    $x0 = (4 / $width) * $px - 2
    $y0 = (4 / $height) * $py - 2
    $x = $x0
    $y = $y0
    $iteration = 0

    [/autoit] [autoit][/autoit] [autoit]

    While (($x * $x + $y * $y) < 4 And $iteration < $maxiteration)
    $xtemp = $x * $x - $y * $y + $x0
    $y = 2 * $x * $y + $y0
    $x = $xtemp
    $iteration += 1
    WEnd
    pix($dc, $px, $py, ($iteration / $maxiteration) * 0xFF) ; I did't had time to implement some fancy colouring
    Next
    Next
    EndFunc ;==>Mandelbrot

    [/autoit]