Jump to content

To Compile or Not to Compile?


ckovoor
 Share

Recommended Posts

I have written several Autoit scripts for use on my personal computer system(s), and of course Autoit is permanently installed on my pc. The latest such script is at: '?do=embed' frameborder='0' data-embedContent>>

Is there any advantage, generally, in compiling .au3 scripts to .exe files in my situation? I am not thinking of distributing the files to others. Will there be any difference in the speed of execution, or in system resource utilization (however minimal) between the two options. Are there any other pros and cons to consider?

I am sorry if this question has been asked/answered before, but I searched and couldn't find any threads dealing with this specifically.

Link to comment
Share on other sites

One thing I know is that if you compile you can use it on a computer without AutoIt installed. Also, It will wrap the Libraries used, making it so if you have any libraries that are in the same directory, you no longer need to have them in the same directory as they will be wrapped inside the script being compiled.

just my 2 cents ;)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

There is big advantage when you compile your scripts.
If you compile any script so you do not have to worry about "script breaking changes" after you update autoit. So you can update autoit without worrying about this problem
in your compiled scripts

Link to comment
Share on other sites

No there's not any advantages,

it's slow if it's compiled, and it's size is bigger.

 

Look up :rolleyes:

You are correct, the size is definitely bigger but that is due to the fact that it does not need all the files in a dir with it, along with the UDF's in the AutoIt include folder. As it has wrapped itself together making it easily portable.

You are incorrect that it is slow. It is the same speed as running from inside the editor. ;)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Another advantage of compiled EXE is simpler starting.

I have set implicit shell operation for AU3 files opening in Scite editor

so if I would want to run AU3 (directly, not from editor)

I would have to define full path to AutoIt.exe and commandline parameters to run AU3 script

which would be absolutely not friendly.

I always compile my AU3 scripts even those that will be run only on my computer.

Link to comment
Share on other sites

First, I need to say "compile" (in fact, it's not compile at all, I often use another word "build to .exe") a script will do 3 jobs:

  • Include any #include file to a larger script.
  • Compress & Tokenize that script.
  • Embed autoit3.exe to the "compiled" file

The side effect is:

  • Since autoit3.exe is embeded directly to .exe file, then the script will run with the exactly version you want. So no need to care about AutoIt is installed or not or "script breaking changes" when update to newer version of AutoIt.
  • The .au3 need 1 line: #include , when the .exe include entire the filename.au3 into it. Plus additional space for autoit3.exe file, so yes, the size of the .exe file is sure larger than the .au3 file.
  • When not "compile", autoit3.exe interprete the .au3 file, line by line. No additional memory is used. When "compile", the .exe file load both the autoit3.exe AND the tokenized script into memory. Easily guess, the "compiled" file will eat more memory.
  • Execute the "compiled" file is totally NOT slower than the "uncompiled". And also, not at the same speed. In fact, the "compiled" file is far fasted. That is, because when not "compile", the autoit3.exe need to read the script file line by line in STRING form, uncompressed. But when "compile", it only need to read the compressed & tokenized data, which is both SMALLER & in a FAMILIAR structure with the computer. It's not make sense with small script. Try to execute a script with a/many loop(s), and use Timer function to benchmark, you will get the result!
  • Editing the .au3 file is easy, but it may be a rick! In the opposite, editing .exe file is impossible (I don't count the option of decompile it, edit the decompiled script and recompile).
  • Use additional resources (ex: image or music files) is far easier with .au3 form. When "compile", you need far more step to get the resources embeded to .exe file and retrieved correctly.

Let me try to sum up:

   = Pros of uncompiled script =

  1. Uncompiled file is more space saver, memory saver than the compiled.
  2. Uncompiled file is easy to edit/change.
  3. Uncompiled file is easy to use additional resources file.

  = Pros of compiled script =

  1. Compiled file give you capability to run your script in another computer which AutoIt is not installed.
  2. Compiled file makes you do not need to care about script breaking after update to newer version of AutoIt.
  3. Compiled file beats un-compiled file entirely in executing script.
  4. Compiled file give you better sign about what you've done is right or wrong. When things go wrong, with the .exe you will get a MessageBox, with the .au3 and SciTe you will get an error message in output window of SciTe. But you run the .au3 by right click/double click, so no error messages.

  = Tie =

  • You can both execute compiled .exe and un-compiled .au3 script with a simple double-click. But you need to enable this option when installing AutoIt.

But in your case, I think it's no reason to "compile" to .exe file.

Edited by binhnx
Added some fomatting

99 little bugs in the code

99 little bugs!

Take one down, patch it around

117 little bugs in the code!

Link to comment
Share on other sites

Please hit the key marked every time you breathe.

That will cause a text wall like yours to split into smaller bricks which are easier to digest.

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

@jchd:

Yep, I'll edit it now, but it's not totally my fault!

By the time I posted that, my internet connection is extremly slow on some specified site (because a asshole shark bites the AAG ocean cable). Autoitscript.com load ok, but the javascript library is not. So I must disable js in order to post a comment. But no js = no line break  :

99 little bugs in the code

99 little bugs!

Take one down, patch it around

117 little bugs in the code!

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