how fast can the output pins switch

The default PWM output routines have a frequency of about 1KHz. Bypassing those with bare calls to DigitalWrite() should allow you to go much faster, and lower-level C code or timer manipulation should be able to take you a bit beyond that. 20kHz probably isn't a problem. Tightly crafted assembly language on this class of AVR has been about to output a VIDEO signal on a port pin.