STM32F401 toggle speed experiment

void setup() {
       pinMode(PC13, OUTPUT);
}

void loop() {
       digitalWrite(PC13, !digitalRead(PC13));
}
Output rate = 421.86kHz

void setup() {
       pinMode(PC13, OUTPUT);
}

void loop() {
       HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
}
Output rate = 1.049MHz

84MHz STM32F401CCU6 WeAct Black Pill V1.2
(GPIO speed register controlling the slew rate at default)