Let’s beat the Array.sort for Numbers, lets beat the best as3 implementation of quicksort and lets beat about any AS3 sorting function you have seen so far. Here 2 really fast algorithms to sort floats (or Numbers), FlashSort and Radix ! FlashSort I presented in an earlier post a really fast flashSort implementation for Integers […]

~ read more ~## Posts tagged alchemy

# Radix SortOn

In this post here, I presented a fast sorting function based on radix algorithm. Today, lets make the code a bit more useful by rewriting it to sort an array of objects, with a “key” string to access our sorting key. The desired API: static public function RadixSorOn(iarray:Vector.<Object> , sorted:Vector.<Object> , key:String):void As seen when […]

~ read more ~# Sort, faster than FlashSort, Radix !

In a previous post, I presented a very efficient sorting function based on flashsort (“http://guihaire.com/code/?p=552) Can we go faster than that ? After some research, I decided to explore a very promising sorting algorithm : Radix And found some interesting articles for radix optimizations: http://codercorner.com/RadixSortRevisited.htm from Pierre Terdiman, and one from M. Herf http://stereopsis.com/radix.html. So […]

~ read more ~# Super fast SortOn with FlashSort !

In this post Super fast sorting with FlashSort !, I presented a really fast algoryhm to sort integers. What about changing it to try to beat the Array.sortOn, and by this making it more usable ? So as far as the API, we want to go from static public function flashSortInt2(a:Vector.<int> , multiplier:Number = 0.43):void […]

~ read more ~# Log2(n) tricks

How to fast compute log2(n) ? We are going to explore few methods. 1)The obvious: var log2:int = Math.log(n)*Math.LOG2E This is going to be incredibly slow, due to the function call, so lets try other methods described in http://graphics.stanford.edu/~seander/bithacks.html, and add some salt to them. 2)Log2 with branch One idea is to divide the number […]

~ read more ~
## Recent Comments