To this point I tried to disable WiFi (I don't need it):
WiFi.disconnect();
WiFi.mode( WIFI_OFF );
WiFi.forceSleepBegin();
(this helped a bit - from 64 us the long loops went down to 54 us). I also tried to disable all interrupts (didn't help at all):
noInterrupts();
What can be possibly happening at exactly 1 second interval? My thinking is that it must be somehow related to WiFi, because for anything else 1 second is ginormous (in terms of CPU cycles). Perhaps the commands I used didn't completely disable WiFi and/or related interrupts?
Anything else beside WiFi could be the culprit? I am trying to figure out NMI - can it be at fault here? I don't use PWM in my code, so perhaps I can somehow disable NMI and/or PWM?
I am using Arduino IDE in my setup.
Thanks for any input.