[never 3 dec 96]
Currently the way the compiler handles initialized arrays is to emit inline code which fills in the values in a newly created array. But it doesn't really need to fill in values that are 0 since the new array should already be full of the default values. This doesn't occur all that often I suspect but there currently in sun.io there are some staggeringly large class files as a result of the way array are initialized. Many of these arrays are large contain a lot of 0's. The savings would be around 15% for the files in sun.io if the compiler were modified to just not emit 0's when initializing an array.
I think all that needs to be done is to change the code around line 110 in sun/tools/tree/ArrayExpression.java to look like this:
for (int i = 0 ; i < args.length ; i++) {
if (args[i].equalsDefault()) // new code
continue; // new code
asm.add(where, opc_dup);
I have no need for this but it seems like it might be a useful optimization. It seems there might be some other simple improvments to the code for initializing arrays...
Currently the way the compiler handles initialized arrays is to emit inline code which fills in the values in a newly created array. But it doesn't really need to fill in values that are 0 since the new array should already be full of the default values. This doesn't occur all that often I suspect but there currently in sun.io there are some staggeringly large class files as a result of the way array are initialized. Many of these arrays are large contain a lot of 0's. The savings would be around 15% for the files in sun.io if the compiler were modified to just not emit 0's when initializing an array.
I think all that needs to be done is to change the code around line 110 in sun/tools/tree/ArrayExpression.java to look like this:
for (int i = 0 ; i < args.length ; i++) {
if (args[i].equalsDefault()) // new code
continue; // new code
asm.add(where, opc_dup);
I have no need for this but it seems like it might be a useful optimization. It seems there might be some other simple improvments to the code for initializing arrays...