Previously I looked at the speed difference between digitalWrite and direct port manipulation. It was a chance to check out a Saleae Logic Analyzer. Andrew at !Crash-Bang Prototyping took the analysis a step further. He broke down what is going on inside of digitalWrite().
This study is useful. When you’re ready to move beyond the Arduino IDE or the core functions, you can decide if you need your own version of digitalWrite().
Check out !Crash-Bang Prototyping’s “How Arduino digitalWrite Works – and why AVR is Faster“.