First things first, thank you for your work on this project, JavaScript Obfuscator, especially when combined with other minification solutions, can produce a _brutally_ undecipherable code; our reverse engineering-protection tests are nearing that of true machine code compilation, so this is indeed getting somewhere.
Please, count on my support if this project turns out to be useful to us.
Problems with micro-optimization
Now, our use case involves a code-base that has lots of tight loops, mercilessly micro-optimized for great runtime performance (it's an audio production suite with considerable amounts of signal processing and audio visualization of often several GB of data, and the latter must run at steady 60 FPS).
JavaScript Obfuscator, by definition, mangles these parts to make them harder to read. This, however, especially with the controlFlowFlattening option enabled, undoes the optimization _badly_, producing a very bad runtime performance degradation.
We actually found that virtually every single option of JavaScript Obfuscator enabled adds a clearly visible runtime performance penalty.
"Standard" and "performance-critical" parts
The mentioned performance issue is only applicable to a very limited part of our codebase, merely a few thousand lines of tight loops total.
It would be great if certain areas of code (e.g. a function, block, annotated region, or method) could be added to an ignore list, so that it does not get transformed in any way that affects performance considerably (e.g. variable names can still be mangled flat in place, but not much more).
While it is theoretically possible to obfuscate files separately, with the selfDefending option enabled, it becomes impractical (if not impossible) to pack files after obfuscation.
Hi! You can use conditional comments fort this case and disable ofbuscation for specific parts of the code.
https://github.com/javascript-obfuscator/javascript-obfuscator#conditional-comments
// input
var foo = 1;
// javascript-obfuscator:disable
var bar = 2;
// javascript-obfuscator:enable
var baz = 3;
// output
var _0xabc123 = 0x1;
var bar = 2;
var _0xdef456 = 0x3;
More advanced solution:
At first you can obfuscate whole code with solution above, then extract all unobfuscated code between conditional comments (this code should be valid) and obfuscate this parts with lower obfuscation preset.
Ah, I'll be damned, I've been looking through the docs a lot, but somehow missed that part. Thank you for your quick response.
Just for clarification, one is supposed to wrap a code segment with a disable-enable pair, is that right?
Yes (if i understood you correctly)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.