Jump to content

Compiler Optimization?


Recommended Posts

Does anyone know if the AutoIt compiler does any type of optimization? Eg:

Before Optimization:

MsgBox(0, "Test", (174/14) * 15.64)

After Optimization:

MsgBox(0, "Test", 194.38)

I know that this would barley make any speed difference at all, but if it were a large script, and not doing the calculations beforehand made it more readable, this could be a big time saver.

Link to comment
Share on other sites

I don't believe/hope so.

(174/14) * 15.64 = 194.382857142857 (as displayed by AutoIt, but the internal value is different)

First we are not even close to 194.38

Then what should the following do?

ConsoleWrite(45678/99999 & @LF)

If 45678/99999 = 0.456784567845678 Then MsgBox(0, "Equality test", "Passed!")

Now how big is big, compared to the _utter_ complexity involved?

Common constants elimination can also give good results, as well as loop unrolling and about 1400 optimizations some top-notch C compilers know about. There are also nice trigonometric shortcuts that could save millions of cycles!

Seriously, there are certainly more urgent issues to address.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

It was just an example, i figured putting all those decimal places in there would be unnecessary. I tried doing something like that, and timing it, and the times were much less when compiled. I was just wondering if it did something like that, or it was just faster because it was compiled.

Link to comment
Share on other sites

Did you try running the script multiple times to get an average process time?

From my experience, the first run of a script from SciTE usually takes a longer time then when I run it a second and third time. Must be because the interpreter hasn't been loaded into memory yet or something similar.

Link to comment
Share on other sites

Really?

I just tried a 10000 loop of 50 lines consisting of 12 FP operations involving constants each and on average on 100 runs

From SciTe: 0.00012724... ms each operation

Compiled: 0.00012683... ms each operation

If there is an actual difference it's in the vincinity of 0.32%, it will not haunt me! I can't measure anything that precisely without artificial means, that is I will never perceive the difference.

The stock 2-year old PC I use now makes roughly 7.7 Mflops wih AutoIt and you say we should care if the compiler packs constants to save, say, 1000 FP divide?

Where is the big saving you talked about?

We've all lost much more time chatting in this thread than any Intel or GNU C compiler could ever save with all peephole FP optimizations useable in script-like programs for a lifetime!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I can't speak as to exactly what it does now, but in the past it hasn't done any mathematical expression optimization. It's an on-the-fly script parser though, so when you think about it, it would not make sense to go though the trouble of optimizing the expression (the optimizations you talking about are done at compile time, but AutoIt doesn't actually "compile" like that). The lexer does cache the lines though, so if it's in a loop it doesn't have to get "re-tokenized".

Edited by evilertoaster
Link to comment
Share on other sites

Hmm, ok, I must have been mistaken, it doesn't look like there is any difference between compiled and normal script versions. :/ Something must have been running in the background that affected the speed for me. Sorry for the time waster, I guess it is food for thought though.

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...