Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug messages are not stripped out of production builds #233

Closed
manofearth opened this issue Nov 8, 2018 · 7 comments
Closed

Debug messages are not stripped out of production builds #233

manofearth opened this issue Nov 8, 2018 · 7 comments

Comments

@manofearth
Copy link

@manofearth manofearth commented Nov 8, 2018

I see debug messages in console, whether I use production-build or debug-build. The quickest workaround I found is wrap debug function declaration with code-stripping markers in boomerang.js:

 /* BEGIN_DEBUG */
 boomr.debug = make_logger("debug");
 /* END_DEBUG */
 /* BEGIN_PROD */
 boomr.debug = function() {};
 /* END_PROD */

Stripping out all BOOMR.debug calls is more difficult solution, however it will lead to smaller build size.

@bluesmoon

This comment has been minimized.

Copy link

@bluesmoon bluesmoon commented Nov 8, 2018

How do you create production build v/s debug build? We don't get any debug messages in our production builds.

@manofearth

This comment has been minimized.

Copy link
Author

@manofearth manofearth commented Nov 9, 2018

I use grunt clean build and get build/boomerang-1.0.0.js and build/boomerang-1.0.0-debug.js files. I tried both and got debug messages in console. I inspected build/boomerang-1.0.0.js (which is supposed not to send debug messages, as far as I understand). I didn't notice any difference with build/boomerang-1.0.0-debug.js regarding to sending debug messages.

@nicjansma

This comment has been minimized.

Copy link

@nicjansma nicjansma commented Nov 27, 2018

We actually call BOOMR.init() with {log:null} for our production builds, which mutes the messages, though this still leaves the BOOMR.debug() strings within the production build itself.

This is a great idea to save a few bytes -- removing the actual BOOMR.debug() lines looks like it'll strip off around ~3kb (152 -> 149) from the minified builds.

Adding this to our Performance Push list, to be worked on soon.

@nicjansma

This comment has been minimized.

Copy link

@nicjansma nicjansma commented Dec 27, 2018

This has been fixed in the Akamai fork and will be backported soon.

@khalwat

This comment has been minimized.

Copy link

@khalwat khalwat commented Jan 1, 2019

For clarification, where is the Akamai fork? I'd assumed it was this repo itself, but from the sound of it, it may exist elsewhere?

@ashenoy2014

This comment has been minimized.

Copy link

@ashenoy2014 ashenoy2014 commented Jan 3, 2019

Its a fork that's private under the Akamai org.

@nicjansma

This comment has been minimized.

Copy link

@nicjansma nicjansma commented Jun 3, 2019

Fixed in d7c485d, which removes debug-related messages from production (minified) builds.

While we previously stripped out other debug functions from production builds (via /* BEGIN_DEBUG */ and /* END_DEBUG */), and BOOMR.debug() messages are hidden from BOOMR.init({log: null}), the actual messages (strings) were still in the production builds.

There were 3 types of changes in d7c485d:

  • BOOMR.debug("..."); (single line) messages are stripped via strip_code plugin
  • BOOMR.debug("..." +\n "..."); (multi line) messages are stripped via new /* BEGIN_DEBUG */ that wrap the multiple lines
  • Plugins that use a custom function log() {} that wrapped the plugin's name were all standardized to debugLog() so it can easily be stripped via the strip_codeplugin.
$ grunt perf:compare

...

size.boomerang.debug                                                   :  820130 +1103 (+0%)
size.boomerang.min                                                     :  196125 -9644 (-5%)
size.boomerang.min_gz                                                  :  57123 -3010 (-6%)
  • size.boomerang.debug is boomerang-v1.n.n.debug.js, and we see it's increased in size (1 KB) because of new /* BEGIN_DEBUG */ statements
  • size.boomerang.min is boomerang-v1.n.n.min.js and is now smaller (9 KB) due to the stripped code
  • size.boomerang.min_gz is boomerang-v1.n.n.min.js.gz and is now smaller (3 KB) as well
@nicjansma nicjansma closed this Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.