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“.