How long does analogWrite() take?

different pins do give different times ... I don't know why this is

The code has

switch(timer) {
case TIMER0A:
   //blah
case timer0B:
  // blah
case timer1A:
  // blah
//etc

which will usually results in the same code as you'd get with:

if (timer == TIMER0A) {
} else if (timer == TIMER0B) {
} else if timer == TIMER1A) {
} else if ...

so timers that appear first in the chain will be slightly faster. Also, timer0 is slightly faster to access than the other timers, because it appears in the address range where it can be accessed by IN and OUT instructions.