AutoHotkey Community

It is currently May 26th, 2012, 2:57 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 129 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9  Next
Author Message
 Post subject:
PostPosted: February 1st, 2009, 2:18 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Thanks for the report and the location of the problem.

The compiler/BIN file has been fixed so that SetFormat disables the caching of binary numbers in variables. This makes compiled scripts behave the same as non-compiled scripts.

To use the new version, unzip the following file in your \Program Files\AutoHotkey\Compiler folder:
www.autohotkey.com/misc/AutoHotkey-Pre- ... N-new3.zip (240 KB)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2009, 12:22 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
With this AutoHotkeySC.bin the exe file is twice larger than before (420KB instead of 210KB). Do I need to do something to enable compression?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2009, 5:51 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
http://www.autohotkey.com/forum/viewtop ... 351#247351
seems the problem i describe here happens in the non compiled script with the beta

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Top
 Profile  
Reply with quote  
 Post subject: Darn Green Line!
PostPosted: February 6th, 2009, 3:37 am 
I just wanted to report a bug. It seems that in the following code, two weird greenish lines appear for some unknown reason. The bug occurs only when using the beta EXE and BIN.

The code:

Code:
#SingleInstance,Force
OnExit, GuiClose

Range1 := RGBRange(0xFFFFFF, 0xF00000, -100, "`n")
Range2 := RGBRange(0xF00000, 0x000000, -100, "`n")
   
Gui, Font,s36 w1000000
Loop,Parse,Range1,`n
   {
      Gui,Add,Text,yp+1 x50 BackgroundTrans c%A_LoopField%, _
   }
Loop,Parse,Range2,`n
   {
      Gui,Add,Text,yp+1 x50 BackgroundTrans c%A_LoopField%, _
   }
Gui, Show,, A

Return

RGBRange(x, y=0, c=0, delim=",")
{
   oif := A_FormatInteger
   SetFormat, Integer, H
   dr:=(y>>16&255)-(r:=x>>16&255)
   dg:=(y>>8&255)-(g:=x>>8&255)
   db:=(y&255)-(b:=x&255)
   d := sqrt(dr**2 + dg**2 + db**2)
   v := Floor(d/c)
   IfLessOrEqual, c, 0, SetEnv, c, % d/( v := c<-3 ? -1-Ceil(c) : 2 )
   s := c/d
   cr:=sqrt(d**2-dg**2-db**2)*s*((dr>0)*2-1)
   cg:=sqrt(d**2-dr**2-db**2)*s*((dg>0)*2-1)
   cb:=sqrt(d**2-dg**2-dr**2)*s*((db>0)*2-1)
   Loop %v%
   {
      u := SubStr("000000" SubStr( ""
      . ((Round(r+cr*A_Index)&255)<<16)
      | ((Round(g+cg*A_Index)&255)<<8)
      | (Round(b+cb*A_Index)&255), 3) ,-5)
      StringUpper, u, u
      x .= delim "0x" u
   }
   SetFormat, Integer, %oif%
   return x
}

GuiEscape:
GuiClose:
   ExitApp


Top
  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2009, 5:27 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Binary integers are cached at load time for literal integers in expressions. Since the presence of SetFormat, Integer disables write-caching of binary integers in variables, when the binary integer is assigned to the parameter x, it is assigned as both a binary integer and a numeric string in the current format. In other words, x contains the string "16777215" or "15728640" instead of "0xFFFFFFFF" or "0xF00000". Since the "0x" prefix isn't required for colour codes, the decimal integer (or part of it) is interpreted as a hexadecimal colour code, resulting in the off coloured lines.

One solution may be to add (in the AutoHotkey source) a function which would:
  • be used only to assign a literal integer to a variable,
  • would cache a binary integer in the variable as before,
  • but would also store the original numeric string in the variable if (write-)caching is disabled.
There are at least two workarounds:
  • Pass parameters which aren't in the current numeric format as strings instead of literal numbers.
  • Force each parameter into the correct format.
Code:
Range1 := RGBRange("0xFFFFFF", 0xF00000, -100, "`n")
Range2 := RGBRange("0xF00000", 0x000000, -100, "`n")
;... AND/OR ...
SetFormat, Integer, H
x += 0

Personally, I think v2 should abandon SetFormat - along with all of these issues - in favour of a manual Format() function or other syntax. (I believe Chris wishes to maintain compatibility with older scripts up until v2.)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2009, 5:47 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Thanks for that analysis.

However, I don't fully understand the subtlety of it; so if you think this issue represents a significant incompatibility, I think the source code should be fixed (at least if there's a reasonable way to do so without giving up too much). On the other hand, if this issue is something extremely rare and fixing it would sacrifice performance, maybe nothing should be done.

Laszlo wrote:
With this AutoHotkeySC.bin the exe file is twice larger than before (420KB instead of 210KB). Do I need to do something to enable compression?
I can't reproduce that. Perhaps your upx.exe is missing or damaged. If that's not it, it might be solved by installing the most recent non-beta version and then overwriting the two main files with the beta version again.

tank wrote:
http://www.autohotkey.com/forum/viewtopic.php?p=247351#247351
seems the problem i describe here happens in the non compiled script with the beta
Thanks; that should be fixed in the next release.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2009, 6:13 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Chris wrote:
Laszlo wrote:
With this AutoHotkeySC.bin the exe file is twice larger than before...
I can't reproduce that.
It is not consistent. With the previous beta AutoHotkeySC.bin my script1.exe compiled from a 500 line script1.ahk was 203.5KB, similar size to the non-beta case. With the latest (beta3) AutoHotkeySC.bin the size of script1.exe is 410.5KB. Other scripts did not blow up. Even my 10,000 line real time control script compiles to 214.8KB.

Script1 does not use regular expressions, or other exotic stuff, only transparent windows, which my other compiled scripts do not. It also uses MouseGetPos, relative mouse movements and a Critical subroutine. Is there now an optional component, which is not always included in the exe?

The 210KB size difference is not important. I only report the issue, because it could reveal a potential bug.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2009, 6:21 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
There are no large optional components. In fact, the SC/bin file barely changed from one version to the next because I only included the small section of code that recognizes SetFormat and turns of the caching of binary numbers.

Perhaps this is a bug in UPX itself -- maybe it encounters some unusual pattern of characters that causes it to fail to compress the file. You could try the latest version of UPX from http://upx.sourceforge.net/

If that doesn't help, you might try temporarily renaming your UPX and compiling the script again. If the resulting file size is almost exactly the same as the one with UPX enabled, that would seem indicate that UPX gives up early when trying to compress this particular file.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2009, 6:37 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Chris wrote:
On the other hand, if this issue is something extremely rare and fixing it would sacrifice performance, maybe nothing should be done.
I thought something along those lines.


In your original post you were too specific:
Chris wrote:
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.
It should be something like: "Assigning a literal integer to a variable also converts it to the current integer format." Perhaps the documentation should suggest quoted strings be used to preserve format.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2009, 7:05 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Chris wrote:
You could try the latest version of UPX
Thanks! That reduced the size from 410.5KB to 203.5KB, and the program loads faster, too.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2009, 4:13 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Here is a new beta version that improves the speed of thread creation and fixes all the bugs in the Bug Reports forum that were readily fixable.

If you get a chance, please test it with your most demanding scripts, especially ones that create many threads such as complex GUIs, SetTimer, OnMessage(), and the slow mode of RegisterCallback() (e.g. subclassing).

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: www.autohotkey.com/misc/AutoHotkey-Pre-1.0.48-new4.exe (238 KB)

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

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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2009, 10:57 am 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Working great for me so far with my development versions of SteamWin, SteamLab, and FOMS.

And maybe it's just my anticipation because of your announcement, but SteamWin GUI windows (custom GUIs with a lot of timers and hotkeys) seem to be more responsive and perform better overall now.

I'm really liking the beta version so far.

Thanks, Chris!

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2009, 6:51 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
5 large scripts, one with over 20 threads work flawlessly, also in compiled form. They seem to be faster, too, but it is hard to measure.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 19th, 2009, 3:56 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Thanks Chris, NumPut now works like a charm with Uint64.

BTW, I couldn't test the beta versions extensively, so I've been waiting for Lexikos' additions to be incorporated into it. Although Assume Static and the more flexible dynamic function calls are crucially used, they aren't used heavily so I can temporarily replace them with ones compatible with the beta versions. However, While loop has been used so widely I didn't dare to replace them, and gave up using the beta versions.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 19th, 2009, 8:40 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Thanks Sean, Laszlo, bmcclure, and everyone else who has done some testing.

I forgot to mention that 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 www.autohotkey.com/docs/commands/SetFormat.htm#Fast


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 129 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group