Difference in DigitalWrite Measurements

If you want full control over the process and much faster execution, use direct port manipulation rather than calls to Arduino routines. The C/C++ code often translates as one line to one machine code instruction.