playscript/playscript-mono — pull request #275 by benjcooley (2013-09-25 20:50:13+00:00)
Title: Performance mode

Added the following:

"PEFORMANCE_MODE" to pscorlib which changes the semantics of various methods in Array, Vector, to allow their most common usages to perform at native speeds (i.e. comparable to C++).

1. Specifically, for Array and Vector, getting and setting an indexed value will not automatically grow the array/vector, and will error on accessing a value out of range instead of returning a default or undefined value. This allows these indexed accessors to be inlined, and with ABC removal gives performance identical to C++'s vector<> type.

Since this is incompatible with how ActionScript typically works, in DEBUG mode accessing an out of range index will throw an exception - allowing the code assuming the original behavior to be identified and fixed. In RELEASE mode no exeption is thrown except for normal array bounds exceptions (which may not be thrown since the inner array of a Vector or Array is usually larger than the current .length).

2. Various methods of Array and Vector.<> are modified to not return an Array or Vector.<> as a return value. Specifically splice() is changed to return void.

The PERFORMANCE_MODE macro is reserved for other changes to the runtime that change runtime semantics in a breaking way to achieve large performance gains.

3. the Array class is optimized and may be toggled using the #if macro in the Array.as file.