Obfuscation takes extremely long for large files (12+ hours)
See original GitHub issueI have a javascript file that’s 24 MB big. In javascript terms, where things like jquery are about 84 KB, I would call my file above average big.
I had not issues running the obfuscation on the same file when it was just 500 KB large and I’ve tested running the program on the same file in both Linux and Windows.
Currently the obfuscation has been going for 12 hours, and is still going. Exactly what it’s doing I don’t know, but it’s eating 50% of my CPU so I know it’s still doing something and when it crashed once before due to Nodejs running out of memory I increased it to 6 GB and so now it’s not crashing but as I said, it’s been 12 hours already…
Here’s the command I used (absolute paths due to my setup):
/usr/bin/nodejs /home/$USER/Programs/emsdk/node/4.1.1_64bit/lib/node_modules/javascript-obfuscator/bin/javascript-obfuscator.js MyJavascript.js --output Build/MyJavascript.js --compact true --controlFlowFlattening false --controlFlowFlatteningThreshold 0 --deadCodeInjection true --deadCodeInjectionThreshhold 0.1 --debugProtection true --debugProtectionInterval true --disableConsoleOutput true --log --mangle false --renameGlobals false --rotateStringArray true --selfDefending true --sourceMap false --stringArray true --stringArrayEncoding 'rc4' --unicodeEscapeSequence false --domainLock "https://my.game.com" --sourceMapBaseUrl "https://my.game.com"
Important thing to note here is that I’ve also tried running the obfuscation without any options (the above is for my release version) and it doesn’t seem to make any difference.
Here’s the output it’s showing currently:
[javascript-obfuscator] Obfuscation started...
[javascript-obfuscator] Random generator seed: 229941782...
[javascript-obfuscator] Stage: preparing AST-tree...
[javascript-obfuscator] Stage: analyzing AST-tree...
[javascript-obfuscator] Stage: dead code injection...
[javascript-obfuscator] Stage: obfuscation...
As you can see, it’s stuck at the obfuscation stage.
The source code I’m compiling is an Emscripten compiled file, which is why it’s so large. I’ve had no issues in obfuscating code due to Emscripten, it works fine, the problem is almost definitely related to javascript-obfuscator not handling large files very well. And yes, I know the performance drops from obfuscation and that Emscripten is already very heavy for a browser to handle, but at the very least I want to disable console output, so even if I later on decide the performance drop is too big to do full obfuscation I still want javascript-obfuscator to handle disabling console output.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (7 by maintainers)
Top GitHub Comments
Amazing, because i never didn’t test so large files.
Works like a charm