Time to time a developer has to ask from Self: “is this really the fastest way to do it?”
After some investigation in most cases the result is “no it wasn’t”. Here’s an example:

I have used (a little modified version of) the Andre Michelle’s port from Bresenhams line algorithm and always thought it would be the fastest way to draw a line on BitmapData in Flash.

I was playing with lines and asked my self the previous question. After some Googling I found this Extremely Fast Line Algorithm (EFLA) written by Po-Han Lin. I gave it a try and ported it to as3. By default it was way faster then the Bresenhams version, but after some AS3 specific optimizations it came out TWO times faster and here it is for you:

private function efla(x:int, y:int, x2:int, y2:int, color:uint):void
{
  var shortLen:int = y2-y;
  var longLen:int = x2-x;

  if((shortLen ^ (shortLen >> 31))(shortLen >> 31) > (longLen ^ (longLen >> 31))(longLen >> 31))
  {
  shortLen ^= longLen;
  longLen ^= shortLen;
  shortLen ^= longLen;

  var yLonger:Boolean = true;
  }
  else
 {
  yLonger = false;
 }

  var inc:int = longLen < 0 ? -1 : 1;

  var multDiff:Number = longLen == 0 ? shortLen : shortLen / longLen;

  if (yLonger)
  {
    for (var i:int = 0; i != longLen; i += inc)
    {
      this.bit.setPixel(x + i*multDiff, y+i, color);
    }
  }
  else
  {
    for (i = 0; i != longLen; i += inc)
    {
      this.bit.setPixel(x+i, y+i*multDiff, color);
    }
  }
}