Does any compressor eliminate the removal of switch enclosures that are not called anywhere in the application?
function execute_case(id) { switch(id) { case 0: console.log("0"); break; case 1: console.log("1"); break; case 2: console.log("2"); break; case 3: console.log("3"); break; default: console.log("default"); break; } } execute_case(1);
If the above is all that I have, then theoretically cases 0,2,3 are dead code and will never be executed. Does any compressor have the intelligence of deleting this code when chopping code?
I am considering a piece of code that contains more than 200,000 cases in a switch statement, and therefore the question.
Thanks, -Vikrant
performance javascript google-closure-compiler yui-compressor
v2b
source share