Hello everyone!
I am wondering, why the ESP32 is slower than the ESP8266.
In my case I have several ESP8266 boards (NodeMCU V3, D1 Mini V2.3.0, D1 Mini Pro,…) and the DOIT ESP32 DEVKIT V1.
All the ESP8266 boards are at least 4x faster than the ESP32.
Only difference in code is:
For ESP32:
#include <WiFi.h> //Wifi
#include <WiFiClientSecure.h> //Blynk SSL
#include <BlynkSimpleEsp32_SSL.h> //Blynk SSL
For ESP8266
#include <ESP8266WiFi.h> //Wifi
#include <BlynkSimpleEsp8266_SSL.h> //Blynk SSL
#include <ESP8266mDNS.h> // for OTA
In the loop(), I am doing this:
Blynk.run();
ArduinoOTA.handle(); // For OTA updates
timerMinutes(); // timer gets called every minute to control things
timerSeconds(); // timer gets called every second to control things
// some other blynk related functions here...
// and finally the speed test
speedcounter++;
if (speedcounter >= 100)
{
speedcounter = 0;
unsigned long currentSpeedCheckMillis = millis();
Serial.println(currentSpeedCheckMillis - previousSpeedCheckMillis);
previousSpeedCheckMillis = currentSpeedCheckMillis;
}
If I have a look at the SerialMonitor, I get values about 9-11 (ms) from the ESP8266 NodeMCU V3 while the ESP32 only gives me 43-48 (ms) with sometime very slow ~120 (ms) every 5 seconds.
So one loop needs about 10/100 ms = 100µs for the ESP8266 while the the ESP32 needs about 45/100 = 450µs for the same task.
I am uploading the code with the Arduino IDE.
ESP8266 is set to 80MHz CPU frequency.
The funny thing is, that I can choose 160MHz CPU frequency for the ESP8266.
This makes it even faster and gives me values of 4-5 in the Serial Monitor.
There is no option availible for the ESP32, but the flash frequency is set to 80MHz.
To be fair, the ESP8266 is even faster than 4x (or 8x with 160MHz) , because serial communication is always slow.
How is this even possible?
Is the SSL communication the reason, why the ESP32 is so much slower - even if it should be faster?
Maybe it is integrated in a different way or perhaps its another reason I dont know.
I hope someone can give me more information