For example, use float $a[42]; instead of float $a[];. All arrays grow as required, so if you know don’t know exactly how many elements an array might hold, but you know a reasonable maximum, use it. Without a size specified, MEL uses a default size of 16 elements for allocating memory for arrays. For example, use
float $a[50]; $a=`someCmd`;
where someCmd would typically return less than 50 things. For the same reason, use explicit size when initializing arrays. For example, use
float $a[15] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
When MEL has complete type information at compile time, it can produce executables which use functions specific to these data types to run the script. If MEL cannot determine a variable’s type at compile time, it must defer the type checking to runtime. This is an overhead which is avoided if type information is known at compile time.