View Full Version : Debug statements
avanloov
04-25-2006, 09:47 AM
Does the compiler exclude all references to Debug (the handy debugging window) when debug="false" (the default on the canvas)? We would like to know whether we should be concerned about performance implications when peppering Debug messages within our LZX.
jstretch
04-25-2006, 09:53 AM
They have debug statements all over the LPS..I wouldn't worry about it. I'm sure its excluded from the compilation when there isn't a debugger.
http://www.laszlosystems.com/lps-3.2/docs/guide/debugging.html
avanloov
04-25-2006, 10:05 AM
Thank you, but one thing that troubles me is that I never see any debug messages from the base components (LPS? bear with me, I'm new).
jstretch
04-25-2006, 10:11 AM
LPS = Laszlo Production Server (compiler)
I'm not sure if there will be many debug statements in the base components..you'd have to dig deeper into the javascripts etc.... but I'm just letting you know that they exist elsewhere and I'm sure the laszlo developers accounted for this already.
Also have you ever noticed the size of your app when its compiled with debugging versus compiled without? Its about 150K difference usually.
jim.mack
04-25-2006, 10:24 AM
There is another component to the question. Is the string created inside the debug statement?
For example,
Debug.write('My value = ' + value);
Does Laszlo create the temporary string object 'My value = ' + value? If value small not a big deal, but debug strings are truncated at 1024, if we log frequently this can add up.
Should we use the log4j features found http://www.openlaszlo.org/lps-latest/docs/deploy/logging.html or can we rely on the Laszlo compiler(?) to filter out the debugs for us?
avanloov
04-25-2006, 11:17 AM
Jim,
It appears that the compiler "compiles the application with additional instrumentation to perform runtime error checking." Which suggests more strongly that the debug setting does have special compilation exclusion (though it only states inclusion).
Anyone ever remove Debug calls with debug="false" and see the file size decrease?
-Andre
jstretch
04-25-2006, 01:02 PM
Debugging off, 2 Debug.write statements.
162,242 bytes
Debugging off, 0 Debug.write statemtns
164,188 bytes
jsundman
04-25-2006, 01:51 PM
You may be able to wrap some code in if ($debug) blocks, as described here:
http://localhost:8080/lps-dev/docs/guide/debugging.html#d0e28358
This does not directly answer your question -- one of the compiler guys may help there-- but it may give you a tool to control some of the bloat.
avanloov
04-26-2006, 09:31 AM
Wow. Any known or suspected reason for why removing the Debug.write() statements made the compiled app larger?
jstretch
04-26-2006, 09:36 AM
Originally posted by avanloov
Wow. Any known or suspected reason for why removing the Debug.write() statements made the compiled app larger?
Sorry, but I'm pretty sure thats a typo..they are both suppose to be 164,xxx
avanloov
04-26-2006, 05:26 PM
Uh-oh. I found the following:
521K (533,686 bytes) debug=true
357K (366,059 bytes) debug=false
357K (366,031 bytes) debug=false minus a Debug.write()
357K (366,070 bytes) debug=false with Debug.write() wrapped in "if ($debug) {}"
Can I request that the compiler leave calls to Debug out with debug=false?
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.