I'm using arrays which must be accessed many times every frame, so I'm using builtin arrays. However I often need to resize these arrays, remove entries, add entries etc. I know you can do it with js arrays but they are much slower. As I see it I have two options:
// Using only builtin arrays
function DeleteThingUsingOnlyBuiltin(index) {
// check that index exists in the array, if not return null
if (index >= thingCount) { return null; }
thingCount--;
var thingPositionTemp = bPos;
thingPosition = new Vector3[thingCount];
for (var i=0;i<thingCount;i++) {
var ii;
if (i<index) {ii=i; } else {ii=i+1; }
thingPosition *= thingPositionTemp[ii];*
*}*
*}*
*// Using JS arrays*
*function DeleteThingUsingJSArray( index : int ) {*
*// check that index exists in the array, if not return null*
*if (index >= thingCount) { return null; }*
*thingCount--;*
*var jsArray = new Array (thingPosition);*
*jsArray.RemoveAt(index);*
*thingPosition = jsArray.ToBuiltin(Vector3);*
*}*
*```*
*<p>The JS version is neater and easier to implement (especially as there are more attributes than this in the actual code), but is it going to slow me down significantly compared to the purely builtin version? I will still do all my array ACCESSING through builtin arrays.</p>*