When accessing a vector such as v:Vector.<int> , we often have to access by index i , i+1 etc. Few suggested this trick , force cast (i+1) to an int, and do v[int(i+1)]. Is that trick working ? Let’s find out ! First, lets create a really large Vector: var REPS:int = 300000; //number of […]

~ read more ~## Monthly archives for September, 2013

# Euclidean division

How to fast perform the euclidean division of two integers and compute the rest the of the division at the same time ? The naive approach is to simply get the result using the / and the % operator: q = i/j; r = i%j; As we know, modulo is very slow, so instead, we […]

~ read more ~# Fastest way to sort Numbers ?

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 ~# min max float in byteArray

In a previous post, I explored ways to compute the Math.min or Math.max for Numbers (http://guihaire.com/code/?p=550) What if we need to perform this operation when the floats are in a ByteArray ? Lets explore some interesting methods So our ByteArray contains a list of floats or numbers, the easiest way is to use the ternary […]

~ read more ~
## Recent Comments