Mantis - Quercus
Viewing Issue Advanced Details
3353 minor always 02-23-09 14:13 02-26-09 08:11
koreth  
nam  
normal  
closed 4.0.0  
fixed  
none    
none 4.0.0  
0003353: Large autoinitialized arrays fail to compile
We have a string table in a PHP array that has recently grown too large to compile. The code looks something like this:

function get_string_table() {
  return array(
    'abc' => array('Hi there', 'Initial message at startup'),
    'def' => array('No room', 'Error: not enough space'),
    'ghi' => array('No session', 'Shown when session can\'t be established'),
    ...
  );
}

The PHP file, which is about 90% made up of array elements like the above, is about 164KB.

My workaround for now is to split this file into two functions and have the first one merge its array with the second one's, but that means the array has to be constructed on each hit, even though it's static data that is never modified at runtime.

It would be better if Quercus could automatically split this up into separate .java files; it could do the array assembly once at class initialization time and keep the finished array around for reuse on subsequent requests.

The biggest problem this is actually causing us is that this file fails to compile and causes Quercus to fall back to one-file-at-a-time compilation mode, so it takes ages to compile our PHP code base.

Notes
(0003845)
nam   
02-26-09 08:11   
php/374g

Fixed for constant arrays. Regular arrays will take a little more work.