Collection of observed times for the Arduino (ATMega328P @ 16 MHz) to complete specific operations. Code example and oscilloscope printouts provided for each example
Simple Operations
Toggling a pin via digitalWrite()
Time from High to Low: 3.360us
Time from Low to High: 3.5us
Average time to toggle pin: ~3.43us
void loop() {
digitalWrite(TEST_PIN, HIGH);
digitalWrite(TEST_PIN, LOW);
}
High Low
Toggling a pin via digitalWrite() with digitalRead() and boolean operation:
Total time: 5.320 us
Less toggle time: ~3.43us
Time of digitalRead() with boolean operation: ~1.89us
void loop() {
digitalWrite(TEST_PIN, !digitalRead(TEST_PIN));
}

delayMicroseconds()
Toggling a pin with a microsecond delay
10us delay: 12.20us
15us delay: 17.2us
void loop() {
digitalWrite(TEST_PIN, HIGH);
delayMicroseconds(DELAY_INTERVAL); // Tested with 10 and 15
digitalWrite(TEST_PIN, LOW);
}
15 us delay 10 us delay
Simple if and boolean write
bool testVar = false;
void loop() {
digitalWrite(TEST_PIN, HIGH);
if(testVar == false) {
delayMicroseconds(10);
testVar = true;
digitalWrite(TEST_PIN, LOW);
} else {
delayMicroseconds(15);
testVar = false;
digitalWrite(TEST_PIN, LOW);
}
}

Dynamixel Servo Operations
writeControlTableItem()
Time to send command via writeControlTableItem()
Example packets: 98.60 us
Send line high: 116 us
...
void loop() {
dxl.writeControlTableItem(MOVING_SPEED, 6, 500);
delay(1000);
}
Send Line Packet