This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require.registerExtension('.js', function(js){ | |
return js.replace(/^ *\/\/debug: */gm, ''); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (options.debug) require('./debug'); | |
while (iAmParsingStuff) { | |
//debug: console.log('state -> %s', this.state) | |
} |
Haha, nice. This could be a feature supported by node.
yeah that would be cool, just require('debug')
to enable. Highly doubt anything like it would ever get in haha, but its a nice alternative to having actual conditionals scattered throughout your lib slowing it down
Did you happen to test how much slower? Just curious.
nah, it only has an effect when required so it doesnt really matter, and it would only affect the initial boot
oh, you meant the extra function calls? it depends. writing a streaming parser an extra function call or two could add up quite a bit if you parse 50kb, that could be 50k calls that you dont want :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sweeeeeeet