Faster Pin I/O on Zero?

nice !

but I don't understand, why your code is 5Mhz fast,
and the arduino core 0,352MHz slow ?
(14 times slower)

cause the arduino core here
..\packages\arduino\hardware\samd\1.6.0\cores\arduino\wiring_digital.c
does almost the same by usingPORT->Group[g_APinDescription[ulPin].ulPort].OUTCLR.reg = (1ul << g_APinDescription[ulPin].ulPin)is it just due to some function-calls overheads ?

and:
why does the arduino core function sets the pull-up resistor each time the "digitalWrite" function is used ?

void digitalWrite( uint32_t ulPin, uint32_t ulVal )
{
  // Handle the case the pin isn't usable as PIO
  if ( g_APinDescription[ulPin].ulPinType == PIO_NOT_A_PIN )
  {
    return ;
  }

  // Enable pull-up resistor
  PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_PULLEN) ;

  switch ( ulVal )
  {
    case LOW:
      PORT->Group[g_APinDescription[ulPin].ulPort].OUTCLR.reg = (1ul << g_APinDescription[ulPin].ulPin) ;
    break ;

    case HIGH:
      PORT->Group[g_APinDescription[ulPin].ulPort].OUTSET.reg = (1ul << g_APinDescription[ulPin].ulPin) ;
    break ;

    default:
    break ;
  }

  return ;
}