ARDUINO DUE vs ARDUINO MEGA

You will have a real speed upgrade by programming directly the DUE peripherals and GPIOs.

You will find numerous example sketches for programming directly the DUE peripherals and GPIOs in the DUE sub-forum of this forum (ADC instead of analogRead, PWM or DAC instead of analogWrite and PIOA/PIOB/PIOC/PIOD instead of digitalRead/digitalWrite).

I have not done measurements (I don't have a Mega), but I doubt that you could expect anything spectacular in speed enhancement by using analogRead or digitalWrite on a DUE.