Sign in to follow this  
Followers 0
Jdonner

How speed and size

32 posts in this topic

#1 ·  Posted (edited)

Hi. I've been looking at AutoIt and it seems exactly what I'm looking for. I have two questions; how big are the executables that the compiler creates. Let's say I create a simple Notepad program; are we then talking about hundreds of Kbytes or a few MB.

How about speed? I tried for example the dice example that's part of the setup (see attachment) and noticed that clicking on the button wouldn't always roll the dice (and I tried the 100 dice, so chances of getting the same number are small) or the number wouldn't appear all that fast. To me that's an indication of something being slow. I can't blame my computer though, it's a Core2Duo E6600.

Thanks for your help

post-22279-1176149335_thumb.gif

Edited by Jdonner

Share this post


Link to post
Share on other sites



Hi. I've been looking at AutoIt and seem exactly what I'm looking for. I have two questions do; how big are the executables that the compiler creates. Let's say I create a simple Notepad program; are we then talking about hundreds of Kbytes or a few Mega Bytes.

How about speed? I tried for example the dice example that's part of the setup (see attachment) and noticed that clicking on the button wouldn't always run the dice (and I tried the 100 dice, so chances of getting the same number are small) or the number wouldn't appear all that fast. To me that's an indication of something being slow. I can't blame my computer though, it's a Core2Duo E6600.

Thanks for your help

That is not an indictation of how fast a script runs. It all depends on what you are doing. Scripts run as fast as processor can process it. Generally it runs fast enough that a person can't compute that fast obviously. Also compiled exe are relatively small depending on how lengthy your script is but doesn't tend to add in size unless you include additional items such as images, other programs etc. Most exe's are tiny for small scripts.


EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites

AutoIT is a script interpreter, not a compiled language. A "compiled" AutoIT script is just an interpreter plus a compressed image of the script (with expanded #include references). The following script compiles to 197KB:

MsgBox(64, "Done", "Done")

I have some script that go to 2,000 lines of script code and comments. Most are about 220KB, not one of them has ever been over 300KB.

Speed is entirely too subjective to evaluate from your post. What do you want to script? I'm not familiar with your 'dice' script, but it may not be optimized to run smoothly (does it use a clunky GuiGetMsg loop?) or fast (is the math done efficiently?).

:shocked:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ok, I'm convinced about the size right now, yet not about the speed.

Speed is entirely too subjective to evaluate from your post. What do you want to script? I'm not familiar with your 'dice' script, but it may not be optimized to run smoothly (does it use a clunky GuiGetMsg loop?) or fast (is the math done efficiently?).

What do you mean with "your dice sciprt? I said in my post: "I tried for example the dice example that's part of the setup". It's not my dice script, it's someone elses. Its in examples/gui/advanced.

does it use a clunky GuiGetMsg loop?

Actually it does, could that be the reason? Excuse me for asking, but I don't know yet what GuiGetMsg does and why it should be avoided when it comes to speed.

That is not an indictation of how fast a script runs. It all depends on what you are doing.

I agree, it all depends what youre doing, but as a professional programmer that I was several years ago, I can tell you that the dice script shouldnt run that slow by looking at the source. Also dont forget, I use fast core2duo and even with an interpreted language I should see much faster speed. Im not here to put down the language, I just want to know what kind of speed to expect before I put many hours into AutoIt. Understand that as a married man and father of 4 with a job and who also runs a large web site, that I dont want to waste my time on things that could have been avoided if I had done some more research.

So if anyone is willing to look at the dice example (its in examples/gui/advanced) and can explain to me what its not rolling the dice all that fast, I would very much appreciate it.

Edited by Jdonner

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

NVM - I found it in ...\AutoIt3\Examples\GUI\Advanced.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

NVM - I found it in ...\AutoIt3\Examples\GUI\Advanced.

Mmm... I remember I wrote twice in my post that it ws in examples/gui/advanced. I'm starting to doubt your reading skills. :shocked:

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@Psalty: You're looking in the wrong spot maybe?

C:\Program Files\AutoIt3\Examples\GUI\Advanced\dice.u3

@Jdonner: I don't know about your computer, but on mine this example runs as fast as I would need it to be: Instant. :shocked: And I'm not running a beast by any means (I experience lots of slow down in Half Life 2 if the level is too large :P).

No slow appearance of a number, and only once did the die "not roll" but I assume that was just the off chance that it actually randomized the same number.

*Edit:

I'm starting to doubt your reading skills.

Hey man, give him some credit. Look at his location, he's from Mars! :( Edited by Saunders

Share this post


Link to post
Share on other sites

I don't know about your computer, but on mine this example runs as fast as I would need it to be: Instant.

When I click really fast on D100 for example, then I don't see as many numbers as numbers of clicks, it's like it ignores some of my clicks. It's hard to see, but it's there, trust me.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I tried it on my wife's and son's computer, the same story and those are a Pentium III and IV

EDIT: I also noticed when you click more slowly on D100 that it often will show the same number. Now I start to think that the program is not slow, but that it has a bug, well... actually I'm 100% sure it has a bug.

Edited by Jdonner

Share this post


Link to post
Share on other sites

I looked and completely missed it, then saw it looking again. The button actions are sensed by a GuiGetMsg() loop in that script. A re-write for event-based buttons would make it more reliable. As for speed, the numbers come up instantly (to the eye at least). I don't have the CPU bling. P4 2.4GHz, 512MB RAM, XP Pro SP2.

Run this modified version and you will get the time from GuiGetMsg() to completing the post of data (100 sided button only). I got <1ms every time:

; autoit version: 3.0
; language:       English
; author:         Larry Bailey
; email:          psichosis@tvn.net
; Date: November 15, 2004
;
; Script Function
; Creates a GUI based dice rolling program
; using the Random function

; Modified by PsaltyDS to display processing time for 100-sided die.  04/09/07

#include <GUIConstants.au3>

GUICreate("Dice Roller", 265, 150, -1, -1)

$button1 = GUICtrlCreateButton("D2", 5, 25, 50, 30)
$button2 = GUICtrlCreateButton("D3", 65, 25, 50, 30)
$button3 = GUICtrlCreateButton("D4", 125, 25, 50, 30)
$button4 = GUICtrlCreateButton("D6", 5, 65, 50, 30)
$button5 = GUICtrlCreateButton("D8", 65, 65, 50, 30)
$button6 = GUICtrlCreateButton("D10", 125, 65, 50, 30)
$button7 = GUICtrlCreateButton("D12", 5, 105, 50, 30)
$button8 = GUICtrlCreateButton("D20", 65, 105, 50, 30)
$button9 = GUICtrlCreateButton("D100", 125, 105, 50, 30)
$button10 = GUICtrlCreateButton("Clear Dice", 185, 105, 65, 30)
$output = GUICtrlCreateLabel("", 185, 45, 70, 50, 0x1000)
$die = GUICtrlCreateLabel("", 185, 25, 70, 20, 0x1000)
GUICtrlSetFont($output, 24, 800, "", "Comic Sans MS")

GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    $ButtonTimer = TimerInit()
    Select
        Case $msg = $button1
            $results = Random(1, 2, 1)
            $results = "  " & $results
            GUICtrlSetData($output, $results)
            GUICtrlSetData($die, "2 Sided Die")
        Case $msg = $button2
            $results = Random(1, 4)
            $results = Int($results)
            $results = "  " & $results
            GUICtrlSetData($output, $results)
            GUICtrlSetData($die, "3 Sided Die")
        Case $msg = $button3
            $results = Random(1, 4, 1)
            $results = "  " & $results
            GUICtrlSetData($output, $results)
            GUICtrlSetData($die, "4 Sided Die")
        Case $msg = $button4
            $results = Random(1, 6, 1)
            $results = "  " & $results
            GUICtrlSetData($output, $results)
            GUICtrlSetData($die, "6 Sided Die")
        Case $msg = $button5
            $results = Random(1, 8)
            $results = "  " & $results
            GUICtrlSetData($output, $results)
            GUICtrlSetData($die, "8 Sided Die")
        Case $msg = $button6
            $results = Random(1, 10, 1)
            If $results < 10 Then $results = "  " & $results
            If $results > 9 Then $results = " " & $results
            GUICtrlSetData($output, $results)
            GUICtrlSetData($die, "10 Sided Die")
        Case $msg = $button7
            $results = Random(1, 12, 1)
            If $results < 10 Then $results = "  " & $results
            If $results > 9 Then $results = " " & $results
            GUICtrlSetData($output, $results)
            GUICtrlSetData($die, "12 Sided Die")
        Case $msg = $button8
            $results = Random(1, 20, 1)
            If $results < 10 Then $results = "  " & $results
            If $results > 9 Then $results = " " & $results
            GUICtrlSetData($output, $results)
            GUICtrlSetData($die, "20 Sided Die")
        Case $msg = $button9
            $results = Random(1, 100, 1)
            If $results < 10 Then $results = "  " & $results
            If $results > 9 And $results < 100 Then $results = " " & $results
            GUICtrlSetData($output, $results)
            GUICtrlSetData($die, "100 Sided Die")
            ToolTip("Results in: " & TimerDiff($ButtonTimer) & "ms", 100, 100, "Dice Timer")
        Case $msg = $button10
            GUICtrlSetData($output, "")
            GUICtrlSetData($die, "")
    EndSelect
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

See how this works on yours.

Cheers.

:shocked:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

As for speed, the numbers come up instantly (to the eye at least). I don't have the CPU bling. P4 2.4GHz, 512MB RAM, XP Pro SP2.

Not for me and I checked on 3 computer now. Check my previous post, you might have missed that one. The program also has a bug somewhere.

Btw, I would love to try your example, but when I copy/paste it into a new empty source I can't:

a ) use "save as" ; it doesn't allow me to save it, I can't select a type

B ) I can't compile it, option is grayed out.

Edited by Jdonner

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Ok, I modified the original source instead with your changes. I get less then 0.4ms, so there obviously is something else wrong. Like I said, when you click slowly (about 1/3 or 1/2 sec) you'll often see the same number TWICE, just try it, it happens to me on 3 different computers.

Edited by Jdonner

Share this post


Link to post
Share on other sites

C'mon guys, none of you AutoIt experts can explain to me why I often see the same number TWICE, most visible when you click at a speed of 1 click every 1/2 or 1/3 of second?! :shocked:

Share this post


Link to post
Share on other sites

I just checked this out. Two rapid clicks are being interpreted as a double-click. You can assign a different function to a button for a double-click - but in this example the double-click is not assigned which is why it looks like nothing happened.

This may or may not be a bug, I'll check with JP if the double click notification should be on by default for a button (buttons are not something you usually expect to react to double clicks, it's more a listview kind of thing).

When I turned the double click messages off it was lightning fast.

Share this post


Link to post
Share on other sites

Explains why I didn't see it. Laptop with touchpad over here, I use the keyboard for most of the navigation, so when I tested I just highlighted the button and pressed Enter or Spacebar a lot.

Share this post


Link to post
Share on other sites

Explains why I didn't see it. Laptop with touchpad over here, I use the keyboard for most of the navigation, so when I tested I just highlighted the button and pressed Enter or Spacebar a lot.

Correct, rapid spacebar presses wouldn't trigger a double-click message.

Share this post


Link to post
Share on other sites

This may or may not be a bug, I'll check with JP if the double click notification should be on by default for a button (buttons are not something you usually expect to react to double clicks, it's more a listview kind of thing).

Thanks Jon!

Explains why I didn't see it. Laptop with touchpad over here, I use the keyboard for most of the navigation, so when I tested I just highlighted the button and pressed Enter or Spacebar a lot.

Thanks a lot Saunders, you've just convinced me about the speed and now I'm ready to start learning this beautiful product. Why? Because I just tried your method (using he keyboard) and then the program is super fast, no delay it all, so it's indeed a mouse issue. Thank God it's this fast, because from what I've seen form this program it's exactly what I'm looking for. Thanks all for your help guys!

Share this post


Link to post
Share on other sites

C'mon guys, none of you AutoIt experts can explain to me why I often see the same number TWICE, most visible when you click at a speed of 1 click every 1/2 or 1/3 of second?! :shocked:

I'm not convinced. I created a test script to check for randomized distribution. It clicks every 200ms and got standard distribution every time. Start the dice script, then run this. You can tighten the Sleep() times until things go wrong:

Global $WinTitle = "Dice Roller"
Global $Count = Int(Number(InputBox("Test the dice", "Times to run:  ")))
Global $avRolls[101]
For $c = 0 To 100
    $avRolls[$c] = 0
Next

WinWait($WinTitle)
For $c = 1 To $Count
    ControlClick($WinTitle, "", "Button9")
    Sleep(100)
    $Result = Number(ControlGetText($WinTitle, "", "Static1"))
    If $Result > 0 And $Result < 101 Then
        $avRolls[0] += 1
        $avRolls[$Result] += 1
    EndIf
    Sleep(100)
Next

$Msg = "Got valid results for " & $avRolls[0] & "/" & $Count & " attempts:" & @CRLF
For $c = 1 To 100
    $Msg &= $c & " = " & $avRolls[$c] & "   "
    If Mod($c, 10) = 0 Then $Msg &= @CRLF
Next

MsgBox(64, "Results", $Msg)

I think you are more likely to be bumping up against missed GUI messages, a specific problem with GuiGetMsg() loops, and why event-based gui actions are better. I could be very wrong... wouldn't be the first time, and IANAP (I am not a programmer). :(


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

but in this example the double-click is not assigned which is why it looks like nothing happened.

One last question, before I can move on Jon; how do you assign the double-click?

Share this post


Link to post
Share on other sites

I think you are more likely to be bumping up against missed GUI messages

Actually the messages are buffered inside AutoIt in a queue so messages should never go missing even if you ignore them for a while.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0