AutoHotkey Community

It is currently May 24th, 2012, 2:17 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: April 24th, 2007, 8:40 pm 
all that it takes to defeat listlines is -
Code:
loop 100
{
do this
do that
}

and now all you will see is the loop

i would like to see some added functionality to listlines like -
Code:
listlines off
loop 100
{
do this
do that
}
listlines on

and now you can see what is before and after the loop
would this be much trouble to implement?

my main script has a lot of large loops that are completely debugged, so i don't need to see them, and all they do in the listing is to completely jam me up, so something like this would help me SO much

ps Chris - thank you so much for AutoHotkey - it's awesome and amazing and you keep making it even better all the time


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 24th, 2007, 9:33 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
It would be easy enough to implement, but it would slightly impact the overall performance of the program because an additional check must be performed after every line of code. Although this would probably be less than a 0.5% impact on overall performance, it's still a consideration.

Also, I'm not yet convinced that the benefits are that strong compared to using OutputDebug or MsgBox to help debug a script. If anyone else has a strong opinion about this feature (positive or negative), please post here.

Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 24th, 2007, 10:07 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
I nearly never use ListLines to debug, I use ListVars more frequently.
Hopefully, real debugger support would make this wish less needed.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 24th, 2007, 10:57 pm 
Online
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8620
Location: Salem, MA
It wouldn't be a performance drain if it defaults to off :D

I also rarely use the listing, though, so it wouldn't bug me if it's off.

how much impact could there be by adding if(logging) to the Lines::LogToText function?

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject: another suggestion
PostPosted: April 24th, 2007, 11:06 pm 
Chris wrote:
It would be easy enough to implement, but it would slightly impact the overall performance of the program because an additional check must be performed after every line of code.


clarification: would this be true of all scripts, even those not using the option? if so, then i can really appreciate why you wouldn't want to do this

in that case i would like to suggest that we could have the option of more lines listed if needed. 2000 or so would allow me to see some of the "main" lines (outside of loops) that i usually can't see in the listing.

i've looked at OutputDebug a little, and i use Msgboxs all the time, but i can't figure out how i would be able to see lists of executed lines that are between large loops with these, but maybe that's my unfamailarity with OutputDebug (i probably should look at it some more)

also - what i didn't put in my 1st post is that i use your suggestion of -
listlines
pause
all the time, with hotkeys to puase/suspend/reload - in fact i just used my 3 char hotstring - dbl - to add these lines in this post, but i often need more than that

my main script is large, complex and poorly written enough (i'm still learning programming) that i sometimes have to cut/past the listlines to a file and go over it one line at a time to figure out where the prob is.

i just noticed this comming in -
PhiLho wrote:
I nearly never use ListLines to debug, I use ListVars more frequently.
Hopefully, real debugger support would make this wish less needed.

i also use ListVars all the time, and you are absolutely right about a real debugger, but i need something more that i can use until then.

the main difference between us is that you are a great programmer while i'm still just a novice bungling along the best that i can.
you would have finished my main script (now in ver 150 - both major and minor) months ago and it would work twice as well.
you don't need the lines listed but i can't do without them

i've googled this site for debug and listlines and came up with very little, so any revelant suggestions from anyone would be greatly appreciated


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2007, 2:21 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
The number of lines that fit into the history could be increased, but it would impact memory utilization unless the feature was redesigned.

And to confirm: the feature proposed at the top of this topic would impact performance even if it defaulted to "off" (and the script kept it off). This is because the program would have to check the state of some internal variable right before it executed every script-line to determine whether that line should be logged. Although such a check is an extremely fast operation, it's a consideration for me because I'm a performance freak.

By the way, line-logging itself is an extremely fast operation because merely a pointer to the line is logged, not the entire text of the line. Later, when the user displays the line-history, the pointers are resolved to full text.

I'm still willing to consider the proposal if others say it would definitely help them.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: another suggestion
PostPosted: April 25th, 2007, 9:53 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Just to clarify: I stated that I don't use ListLines to make clear I am neutral on the topic (ie. unconcerned).

And to Chris: when (not if...) AutoHotkey will support debugging, I suppose we can expect a slight drop of performance like the one you describe, with at least a test to check if debugger is active on each executed line.
That's a small price to pay, and I guess that it will be unnoticeable in 99% of the used scripts.
But don't forget that 42% of statistics pulled out of thin air are made up on the spot... :-)

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2007, 11:45 pm 
Online
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8620
Location: Salem, MA
Chris wrote:
And to confirm: the feature proposed at the top of this topic would impact performance even if it defaulted to "off" (and the script kept it off). This is because the program would have to check the state of some internal variable right before it executed every script-line to determine whether that line should be logged. Although such a check is an extremely fast operation, it's a consideration for me because I'm a performance freak.


Wouldn't short circuit evaluation actually make it faster in this case? I will freely admit that I could be completely wrong, but it was a guess.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 26th, 2007, 2:12 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
To add this feature, normally some kind of extra check would have to be done when executing each line to see if that line should be logged. But I just checked this particular implementation: in it, you could get sneaky and change:
sLogNext++
to be:
sLogNext += OneOrZeroDependingOnTheSetting

This would avoid the need to add the extra comparsion (though you could argue that ++ is likely to be a faster operation for the CPU than +=Var).

In any case, it would be good to know that others would definitely benefit from this feature before adding it. It could be one of those features you appreciate more once you become aware of it.

More comments are welcome from anyone.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 26th, 2007, 6:04 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2537
PhiLho wrote:
I nearly never use ListLines to debug, I use ListVars more frequently.
About the same here. I'll usually insert a MsgBox line and/or if statement if (read: when... ;) ) I need to troubleshoot whether an event triggers as expected.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: an interim solution
PostPosted: May 3rd, 2007, 4:28 pm 
i've just thought of an interim solution that that farms the sr with the large loop off script when debugging and it goes something like:

Code:
Loop-Subroutine:
;   this is the new statement at the top of this sr
if Debug   ;   i already have and use this - i toggle it on/off with a menu item and store the inital state in my ini file
   {
   RunWait Main-Debug.ahk Loop-Subroutine var1 var2 etc
   IniRead the array from the ini file
   return
   }

Main-Debug.ahk (non-persistent)
Code:
;   at the very top - this sets it up for the possibility of more sr to be added
if %1%
   {
   gosub % 1
   return   
   }
else
   return   

i then have an exact copy of Loop-Subroutine: with a section added to the top of it to input the vars from the parameters and a section at the bottom to IniWrite the output array to the new [Debug] section added to the bottom of my very large ini file (the loop is so large because it scans 100's of items in dozens of sections of the ini file)

IniRead the array back in Main.ahk from the ini file

now i can peek inside with ListLines and actually see the main code that's executing, and when i turn Debug off then everything is back to normal


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: engunneer and 28 guests


You can 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