Strong typing comes of age in AVM2

Back in ActionScript 2.0 using type annotating was a “best-practice” approach that helped speed up development by identifying type casting errors at compile time. The actual values were stored in memory as dynamically typed atoms so the type annotations never really mattered after you published. However, dynamically typed atoms tended to waste memory as values were loosely stored leaving breathing room for changing values.

With ActionScript 3.0 your dedication to using type annotations will pay off. Not only will you continue to benefit from clearly readable code and compile time error catching you might see a significant reduction in memory usage. This is because the new ActionScript 3.0 virtual machine (AVM2) only stores variables as dynamically typed atoms when the type is unknown. When you strong type your variables, the vm now stores the variable as a native machine type both reducing memory consumption and increasing performance.

Leave a Reply


Bad Behavior has blocked 605 access attempts in the last 7 days.