Jump to content

Working with integer variables


Recommended Posts

  • Moderators

Resource Allocation = Time: 1.32279381876747

Debug: $a = 1 type: String Time: 1.34039382100239

Debug: $a = 1 type: Double Time: 1.67786687972913

Debug: $b = 2 type: String Time: 1.29988587935059

Debug: $c = 3 type: Double Time: 2.79001940190723

Debug: $d = 12 type: String Time: 4.84866093316329

Debug: $e = 0.5 type: Double Time: 2.84924480625331

Debug: $f = 2233 type: Int32 Time: 1.35128906048115

Timer functions aren't the best when ran consecutively with AutoIt. Try putting a message box to see a better recognition (also your timers were not right, you show it after it calls two more functions (ConsoleWrite and VarGetType), TimerDiff should be called before those two calls.
MsgBox(0,0,0)
$Timer = TimerInit()
For $i = 0 to 999
    $a = "1"
Next
$Time = TimerDiff($Timer)
ConsoleWrite("Resource Allocation =     Time:   " & $Time & @LF)

$Timer = TimerInit()
For $i = 0 to 999
    $a = "1"
Next
$Time = TimerDiff($Timer)
ConsoleWrite("Debug: $a = " & $a & " type: " & VarGetType($a))
ConsoleWrite("     Time:" & "   " & $Time & @LF)

$Timer = TimerInit()
For $i = 0 to 999
    $a = $a ^ 2
Next
$Time = TimerDiff($Timer)
ConsoleWrite("Debug: $a = " & $a & " type: " & VarGetType($a))
ConsoleWrite("     Time:" & "   " & $Time & @LF)

$Timer = TimerInit()
For $i = 0 to 999
    $b = "2"
Next
$Time = TimerDiff($Timer)
ConsoleWrite("Debug: $b = " & $b & " type: " & VarGetType($B))
ConsoleWrite("     Time:" & "   " & $Time & @LF)

$Timer = TimerInit()
For $i = 0 to 999
    $c = $a + $b
Next
$Time = TimerDiff($Timer)
ConsoleWrite("Debug: $c = " & $c & " type: " & VarGetType($c))
ConsoleWrite("     Time:" & "   " & $Time & @LF)

$Timer = TimerInit()
For $i = 0 to 999
    $d = $a & $b
Next
$Time = TimerDiff($Timer)
ConsoleWrite("Debug: $d = " & $d & " type: " & VarGetType($d))
ConsoleWrite("     Time:" & "   " & $Time & @LF)

$Timer = TimerInit()
For $i = 0 to 999
    $e = $a / $b
Next
$Time = TimerDiff($Timer)
ConsoleWrite("Debug: $e = " & $e & " type: " & VarGetType($e))
ConsoleWrite("     Time:" & "   " & $Time & @LF)

$Timer = TimerInit()
For $i = 0 to 999
    $f = 11 + 2222
Next
$Time = TimerDiff($Timer)
ConsoleWrite("Debug: $f = " & $f & " type: " & VarGetType($f))
ConsoleWrite("     Time:" & "   " & $Time & @LF)

Keep in mind, interpreted versus compiled are two totally different things.

Your macro program is probably compiled before it is actually ran (as is most languages), unlike autoit that passes a file to the stub exe that runs the interpreted code (Huge difference).

Having said that, I'm not entirely sure it's fair to compare the two.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

The edited version of the code still shows the speed increase from using Integers $f above.

Are you saying we cannot compare QuickMacros with Autoit? Quick Macros is not compiled, it has a separate compiler that costs money to use, Autoit has a compiler and there are no speed differences from interpreted Autoit and compiled version. I am sure they inserted wait states to make the compiled code run with the same timings for continuity between the interpreted version though.

I am not here trying to put Autoit down or say it is not as good as another macro program. Autoit defaults to Double floating point variables, and I was hoping to illustrate the speed difference so that someone here who has clout can make a recommendation to the Creators of Autoit to make defining an integer variable possible.

[font="Franklin Gothic Medium"]---Al[/font]
Link to comment
Share on other sites

Don't do that. You have been here for a little over a day, and I don't appreciate being made fun of.

I've written a variant before; I've seen an old version of the AutoIt variant; they don't always look like you think they'd look. And just because a programmer has power in normal situations, trying to manipulate a type that you have no code access to won't happen.

Link to comment
Share on other sites

  • Moderators

The edited version of the code still shows the speed increase from using Integers $f above.

Are you saying we cannot compare QuickMacros with Autoit? Quick Macros is not compiled, it has a separate compiler that costs money to use, Autoit has a compiler and there are no speed differences from interpreted Autoit and compiled version. I am sure they inserted wait states to make the compiled code run with the same timings for continuity between the interpreted version though.

I am not here trying to put Autoit down or say it is not as good as another macro program. Autoit defaults to Double floating point variables, and I was hoping to illustrate the speed difference so that someone here who has clout can make a recommendation to the Creators of Autoit to make defining an integer variable possible.

You don't seem to understand how this works.

1. You write a script.

2. You "Compile" the script.

That's how I think you are seeing this.

Short version:

1. You write a script.

2. You compile the script.

3. The script is not compiled to machine code, it is injected so to speak into the stub exe.

4. On start up of the stub exe, the stub exe and ALL of its pre processor functions are ran.

5. Then your script is read from the interpreter (stub exe) and then ran.

So in essence, you don't have a machine code compilation, you have a script being read then ran. It's the same as hitting F5 or F7 from SciTe.

There's nothing wrong with comparing, as long as you are comparing apples to apples.

In addition... I find it hard to believe you can create classes and dll's if the code isn't compiled. Maybe that is the pro version I read... I didn't find it very fun to navigate through, or informative quickly enough to hold my interest, so I could be wrong.

P.S.

I should have noted that my previous findings time wise was with 3.2.10 release.

With 3.2.13.1 were a bit different:

Debug: $a = 1 type: String   Time:   0.628571508390033
Debug: $a = 1 type: Double   Time:   0.986158855385252
Debug: $b = 2 type: String   Time:   0.754006444953199
Debug: $c = 3 type: Double   Time:   1.41777795781307
Debug: $d = 12 type: String  Time:   3.61638141160399
Debug: $e = 0.5 type: Double     Time:   1.35128906048115
Debug: $f = 2233 type: Int32     Time:   0.646450875739794
Might give that a try if you haven't already, times were much much faster.

Also, a good point that was made was the "Opt" (options) for MouseClickDelay / MouseClickDownDelay that can be changed (Check the help file for "Opt").

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...