How fast can I read from pins?

How fast can I sample an analog or digital port with the premade routines? What if I wrote routines to access the chip registers directly, setting my own prescalers?

There have been postings on the subject including timings before. Search maybe on direct port access.