CombineDuplicateLiterals: combine duplicate literals into local variables. So the code:
function foo(a)
{
a.b = 12345;
a.c = 12345;
a.d = 12345;
a.e = 12345;
}
gets changed to:
function foo(a)
{
var b=12345;
a.b=b;
a.c=b;
a.d=b;
a.e=b
}
The savings are much more dramatic with large, frequently-used strings. Works with
numbers, strings, nulls, and this-pointers. The this-pointers only get crunched
within the current scope, since child functions might have a different meaning for
the pointer. It will also only pull out reused variables within function scopes
– it won’t create a global variable with the constant, as that may interfere with
other global variables. For the maximum crunching, wrap all your code within a namespace
function scope.