I took apart the for loop and gained another us. After that, I tested the time it actually takes to put the pins high by copying the 16 lines of code and pasted it below. The loop now takes 5 us more time. So that is the most amount of time I can gain by smarted output writing.
Concerning the float;
The signal that will be output by the DAC will be the outcome of some equations which may vary anywhere between -10 V and +10 V. If using integers really speeds up the progress I will keep that in mind when I built de code which does the calculations.
I think the DAC is going to be ok. Now it's time for the ADC, but I am waiting for some logc level converters before I can use the DUE for that purpose.
Get rid of the floats and it will speed up.
scaling integers ---- scaled_value = value x scale_numerator / scale_denominator
don't forget to use an integer type that will hold intermediate results.
biggest step can be gained by removing float divisions as these are the worst.
Volts = analogRead(A0) * 5.0/1024;
performs worse than
Volts = analogRead(A0) * 0.004882812;
but yes removing floats completely gains even more.
Integer scaling is done completely with integers. The order of operations, * before / preserves the most accuracy.
If I want to ensure 3 places extra accuracy I might multiply by an extra 1000 that I don't divide by and treat the result as 1000x bigger. Like in printing I would insert a decimal point before the last 3 digits in text.
Pick your working units to suit your methods and leave what the humans see have it's own routines.