Browse Source

Optimize regular array remove so that is does not allocate any longer

This is a cheap yet very impacting one.
David "Blackmagic" Elahee 9 years ago
parent
commit
0b8b091475
1 changed files with 4 additions and 0 deletions
  1. 4 0
      std/flash/Boot.hx

+ 4 - 0
std/flash/Boot.hx

@@ -242,7 +242,11 @@ class Boot extends flash.display.MovieClip {
 		aproto.remove = function(obj) {
 		aproto.remove = function(obj) {
 			var idx = __this__.indexOf(obj);
 			var idx = __this__.indexOf(obj);
 			if( idx == -1 ) return false;
 			if( idx == -1 ) return false;
+			#if flash19
+			__this__.removeAt(idx);
+			#else
 			__this__.splice(idx,1);
 			__this__.splice(idx,1);
+			#end
 			return true;
 			return true;
 		}
 		}
 		aproto.iterator = function() {
 		aproto.iterator = function() {