Looks like the toggling is being done in a while loop which typically takes more instruction cycles.
Two methods to make this happen:
a) Use timer to generate interrupts and in the ISR, write a code to toggle a bit. This will provide a faster toggle time
b) Use GPIF to route toggle a pin. This toggling will be faster and will happen at the GPIF speed.