 			Array.sort 50000 numbers; 37.285 seconds; 10238787 comparisons
 			Merge Sort 50000 numbers; 2.603 seconds; 585089 comparisons
 		*/
-		public static function test(useDefaultSort:Boolean):void
-		{
-			for each (var n:uint in [0,1,2,3,4,5,50,3000,6000,12000,25000,50000])
-			{
-				var array:Array = [];
-				for (var i:int = 0; i < n; i++)
-					array.push(Math.random() < .5 ? NaN : uint(Math.random()*100));
-				var array2:Array = array.concat();
+		/*
+			Built-in sort is faster when no compare function is given.
+			Array.sort 50 numbers; 0 seconds
+			Merge Sort 50 numbers; 0.001 seconds
+			Array.sort 3000 numbers; 0.003 seconds
+			Merge Sort 3000 numbers; 0.056 seconds
+			Array.sort 6000 numbers; 0.006 seconds
+			Merge Sort 6000 numbers; 0.123 seconds
+			Array.sort 12000 numbers; 0.012 seconds
+			Merge Sort 12000 numbers; 0.261 seconds
+			Array.sort 25000 numbers; 0.026 seconds
+			Merge Sort 25000 numbers; 0.599 seconds
+			Array.sort 50000 numbers; 0.058 seconds
+			Merge Sort 50000 numbers; 1.284 seconds
+		*/
+		private static var _testArrays:Array;
+		private static var _testType:int = -1;
+		public static function test(compare:Object, testType:int = 0):void
+		{
+			if (testType != _testType)
+			{
+				_testType = testType;
+				_testArrays = [];
+				for each (var n:uint in [0,1,2,3,4,5,50,3000,6000,12000,25000,50000])
+				{
+					var array:Array = [];
+					for (var i:int = 0; i < n; i++)
+					{
+						if (testType == 0)
+							array.push(uint(Math.random()*100));
+						else if (testType == 1)
+							array.push(Math.random() < .5 ? NaN : uint(Math.random()*100));
+						else if (testType == 2)
+							array.push('a' + Math.random());
+					}
+					_testArrays.push(array);
+				}
+			}
+			trace("testType =", testType);
+			
+			_debugCompareFunction = compare as Function;
+			for each (var _array:Array in _testArrays)
+			{
+				var array1:Array = _array.concat();
+				var array2:Array = _array.concat();
 				
 				var start:int = getTimer();
 				_debugCompareCount = 0;
-				if (useDefaultSort)
-					array.sort();
+				if (compare === null)
+					array1.sort();
 				else
-					array.sort(_debugCompare);
-				trace('Array.sort', n, 'numbers;', (getTimer() - start) / 1000, 'seconds;',_debugCompareCount,'comparisons');
+					array1.sort(_debugCompareCounter);
+				trace('Array.sort', array1.length, 'numbers;', (getTimer() - start) / 1000, 'seconds;', _debugCompareCount ? (_debugCompareCount+' comparisons') : '');
 				
 				start = getTimer();
 				_debugCompareCount = 0;
-				if (useDefaultSort)
-					sortImmediately(array2);
-				else
-					sortImmediately(array2, _debugCompare);
+				sortImmediately(array2, compare is Function ? _debugCompareCounter : null);
 				//trace('Merge Sort', n, 'numbers;', _immediateSorter.elapsed / 1000, 'seconds;',_debugCompareCount,'comparisons');
-				trace('Merge Sort', n, 'numbers;', (getTimer() - start) / 1000, 'seconds;',_debugCompareCount,'comparisons');
+				trace('Merge Sort', array2.length, 'numbers;', (getTimer() - start) / 1000, 'seconds;', _debugCompareCount ? (_debugCompareCount+' comparisons') : '');
 				
-				if (array2.length == 1 && ObjectUtil.compare(array[0],array2[0]) != 0)
+				if (array2.length == 1 && ObjectUtil.compare(array1[0],array2[0]) != 0)
 					throw new Error("sort failed on array length 1");
 				
 				verifyNumbersSorted(array2);

		
		private function iterate(stopTime:int):Number
		{
			var time:int = getTimer();
			
			while (getTimer() < stopTime)

		public function beginSort(arrayToSort:*, compareFunction:Function = null):void
		{
			// initialize
			compare = compareFunction;
			original = arrayToSort || [];
			source = original;
			length = original.length;
