Jump to content


Photo

Beta version pre-v1.0.48: Up to 3x faster performance


  • Please log in to reply
14 replies to this topic

#1 Chris

Chris
  • Administrators
  • 10727 posts

Posted 21 November 2008 - 07:37 PM

Edit: v1.0.48 has been released, which includes all of the beta features below.

In this version almost all scripts should run faster -- especially scripts that make heavy use of expressions and integer math/comparisons, which may run up to 3x faster. To achieve the full benefit, a script should either avoid using SetFormat (especially "SetFormat Integer"), or use SetFormat's fast mode. This is because the old/slow mode causes some parts of binary-number caching to be disabled for the entire script.

This is a beta release because many low-level changes were made. Although extensively tested, I'd appreciate it if you could try it with your most demanding scripts to ensure a high-quality release.

Performance improvements:[*:33muxak6]Expressions and function calls are compiled more heavily, making them much faster (especially complex integer expressions, including those with commas).
[*:33muxak6]Literal integers in expressions and math/comparison commands are replaced with binary integers, which makes operations involving literal integers faster; e.g. X+5 and "if x > 5".
[*:33muxak6]Binary numbers are cached in variables to avoid conversions to/from strings. This makes numerical operations involving variables much faster. For example, passing an address to DllCall such as DllCall(VarContainingAddress) is up to 2x faster. However, taking the address of a variable (e.g. &var) permanently marks that variable as uncacheable because it allows the user to read/write its contents in unconventional ways.
[*:33muxak6]LOOPs, IFs, and ELSEs that have blocks (braces) are faster due to skipping the opening '{'. A side-effect is that the '{' is omitted from ListLines.
[*:33muxak6]The speed of thread creation has been improved, which should help rapid-fire threads in OnMessage(), RegisterCallback(), and GUI events.Changes that might affect existing scripts:[*:33muxak6]Floating point numbers stored in variables have higher precision; scripts that rely on tiny differences in precision might need updating. Alternatively, using "SetFormat Float" anywhere in the script (e.g. SetFormat, Float, 0.6) disables caching of floating point numbers, which should improve compatibility.
[*:33muxak6]When SetFormat, Integer, Hex is in effect, assigning a literal decimal integer to a variable also converts it to hex. Usually this is only a display issue.
[*:33muxak6]OnMessage(): For performance, the message number and HWND arrive as standard numbers rather than appearing unconditionally as hex. Usually this is only a display issue.
[*:33muxak6]LowLevel & dynamic code doesn't yet work with this version.
[*:33muxak6]In this version, scripts use slightly more memory (proportionate to the number of variables and expressions).Here is the new AutoHotkey.exe. If you wish, you can rename or move your original AutoHotkey.exe and put this one in its place: <!-- w -->www.autohotkey.com/misc/AutoHotkey-Pre-1.0.48-new4.exe<!-- w --> (238 KB)

For those who would like to compile scripts with this release, unzip the following file in your \Program Files\AutoHotkey\Compiler folder:
<!-- w -->www.autohotkey.com/misc/AutoHotkey-Pre- ... N-new4.zip<!-- w --> (240 KB)

Please let me know if you find any problems with it.

Soon I'll try to catch up on the bug reports and wish list forums. I'll also try to include some of Lexikos' changes.

Edit #1: Skan discovered that a command with zero parameters such as "Critical" can prevent a Loop, Exit, or ExitApp beneath it from receiving the correct first parameter. This has been fixed, and the link above now points to the corrected version.

Edit #2: Thanks to Icarus, the release has been fixed so that date-math with EnvSub (-=) works when the second parameter is a variable. The link above points to the corrected version.

Edit #3: LowLevel & dynamic code doesn't yet work with this beta version.

Edit #4: For those who would like to compile scripts with this release, there is now an SC/BIN file above for download.

Edit #5: The compiler/BIN file link above has been fixed on 12/30/2008 so that the /NoDecompile switch works.

Edit #6: Thanks to Lexikos, the release has been fixed so that bitwise operations involving floating point variables don't wrongly cache those variables as integers. The links above point to the corrected version.

Edit #7: Fixed the BIN/compiler ZIP file to contain the new version instead of the old one.

Edit #8: The compiler/BIN file link above has been fixed on 2/1/2009 so that SetFormat disables the caching of binary numbers in variables. This makes compiled scripts behave the same as non-compiled scripts.

Edit #9: There is a new beta version. It improves the speed of thread creation and fixes all the bugs in the Bug Reports forum that were readily fixable. The download links higher above point to the updated version.

Edit #10: I updated the files linked above without changing the filename/URL/version. There was a slight chance that a thread could become permanently uninterruptible if the PC was suspended/hibernated for more than 24 days (this is due to the 32-bit nature of GetTickCount()). This has been corrected.

Edit #11: On 2/19/2009 I updated the files linked above without changing the filename/URL/version. NumPut() has been improved to support UInt64 like DllCall() does. [thanks Sean]

Edit #12: Somewhere along the way, the SetFormat command was enhanced with a "fast mode" that avoids disabling the caching of binary numbers. For more details, see <!-- w -->www.autohotkey.com/docs/commands/SetFormat.htm#Fast<!-- w -->

Edit #13: On 2/20/2009 I updated the SC/bin file linked above without changing the filename/URL/version. The /NoDecompile option has been fixed (thanks pekkle).

Edit #14: 2/21/2009: I updated the files linked above without changing the filename/URL/version. Since backward compatibility is important, the following behaviors have been changed back to the way they were in non-beta versions:
func(0xFF)  ; The called function will now receive hexadecimal format rather than decimal.
x := 1, y := 0xFF  ; Assignments that occur inside pure expressions now retain hexadecimal formatting (isolated assignments like y:=0xFF always did this)
Since there is little performance impact to keep this backward compatibility, it seemed best to do so. It also makes hexadecimal behavior more consistent.

#2 SKAN

SKAN
  • Administrators
  • 9062 posts

Posted 21 November 2008 - 09:06 PM

Great! Thanks Mr.Chris :)

#3 Icarus

Icarus
  • Members
  • 851 posts

Posted 21 November 2008 - 10:08 PM

Thanks Chris.
Will test with the more demanding scripts, and report back on issues.

#4 Chris

Chris
  • Administrators
  • 10727 posts

Posted 21 November 2008 - 10:09 PM

Skan found one issue: a command with zero parameters such as "Critical" can prevent a Loop, Exit, or ExitApp beneath it from receiving the correct first parameter. This has been fixed, the link above now points to the corrected version.

#5 Icarus

Icarus
  • Members
  • 851 posts

Posted 21 November 2008 - 10:25 PM

Another possible issue:
; This gives a different result in the new version
; (always 0)
FileGetTime FileTime, C:\Windows\Winhelp.exe
FileAge := A_Now
EnvSub FileAge, %FileTime%, minutes
msgbox %fileage%


#6 Chris

Chris
  • Administrators
  • 10727 posts

Posted 21 November 2008 - 11:20 PM

The release has been fixed so that date-math with EnvSub (-=) works when the second parameter is a variable. The link in the top post points to the corrected version.

Thanks for the fast testing.

#7 corrupt

corrupt
  • Members
  • 2558 posts

Posted 22 November 2008 - 03:14 PM

Thanks for the Beta release :!: :D . I'll take it for a spin... :D

#8 Pil

Pil
  • Members
  • 55 posts

Posted 23 November 2008 - 12:00 AM

Yes,,,Thank you sir...
All my scripts runs lot faster.
What´s better; the DllCall´s in my scripts are also almost three times faster.
Long live AHK

#9 Krogdor

Krogdor
  • Members
  • 1391 posts

Posted 23 November 2008 - 01:30 AM

Wonderful! Although for now Lexikos' release has more benefits for me, since I usually don't use many high-demand scripts, I'm very glad to see that you haven't given up on the AHK project!

Thanks for your hard work, Chris.

#10 Laszlo

Laszlo
  • Fellows
  • 4713 posts

Posted 23 November 2008 - 01:56 AM

Tried with all of my time critical scripts, even with a 10K line real time musical instrument controller, without any problems, and with noticeable speedup. Thanks!

#11 IsNull

IsNull
  • Fellows
  • 990 posts

Posted 23 November 2008 - 02:01 PM

I'm happy to hear such good news from you. The performance improvement is realy nice. :)

But, there is a big Question;

We have now Lexicos working on AHK_L, Titan comes up with IronAHK, and there are some rumor's of a Version 2 from AHK. So, I'm a bit confused about the new developments. Why not working together for one, big AHK? What's the status quo?

Maby u can give us/me a hint what comes next :D

regards
IsNull

#12 Icarus

Icarus
  • Members
  • 851 posts

Posted 23 November 2008 - 02:09 PM

But, there is a big Question;


Not to try and answer instead of Chris, and not to undermine what Lexikos, Titan and others are doing, but the answer should be obvious.
The official AutoHotkey release is made by Chris.
There are a few talented people in this community doing addons and/or alternative distributions with different features.

You may choose to use the official release by Chris, or any other distribution by the others.

If I am reading the situation as it is, some of the features implemented in the alternative releases, may be embedded in the official release by Chris, and some may not.

#13 SoggyDog

SoggyDog
  • Members
  • 803 posts

Posted 23 November 2008 - 05:37 PM

Thanks, Chris.

I've missed hearing from you.

#14 Klaus, nli

Klaus, nli
  • Guests

Posted 23 November 2008 - 06:48 PM

Thanks for being back again, Chris,
great things to come,
Klaus

#15 jordis

jordis
  • Members
  • 81 posts

Posted 23 November 2008 - 08:12 PM

respect!
I'm going to test my scripts as soon as I can.
Looking forward to the speed boost!