Page 1 of 1

ESP32 slower than ESP8266

Posted: Tue Feb 27, 2018 9:08 pm
by Joegi_Lov
I just wrote my first code for an ESP32 and it seems that both, connection to an AP and web server (website) access, on an ESP32 are significant slower than on an ESP8266! Is that a known "issue"?
Thanks for the answers in advance!

Re: ESP32 slower than ESP8266

Posted: Wed Feb 28, 2018 2:19 pm
by Joegi_Lov
I'm at work at the Moment, but I just found this: https://github.com/espressif/arduino-esp32/issues/32 and I'm also reading Byte by Byte! When I'm home I will try to chnage the code so that it reads more at once!

Re: ESP32 slower than ESP8266

Posted: Thu Mar 01, 2018 3:59 am
by tele_player
Reading one byte at a time is a bad idea on 8266, too. client.available() returns the number of bytes ready to be read.

Also, on 8266, WiFi connection seems fast, because by default, it automatically connects to the last AP used, before you call WiFi.begin(). I don’t know if ESP32 does that.

Re: ESP32 slower than ESP8266

Posted: Sat Mar 03, 2018 8:51 pm
by Joegi_Lov
The following code (searching for a string in a website) takes <2000ms on a ESP8266 and >9500ms (~5 times slower) on a ESP32:

Code: Select all

#include <Arduino.h>
//For use on ESP8266 change the following 4 lines as per comment!-------
#include <WiFi.h>  //<ESP8266WiFi.h>
#include <WiFiMulti.h> //<ESP8266WiFiMulti.h>
#include <HTTPClient.h>  //<ESP8266HTTPClient.h>
WiFiMulti WiFiMulti; //ESP8266WiFiMulti WiFiMulti;
//----------------------------------------------------------------------
void setup()
{
  Serial.begin(115200);
  delay(2000);
  WiFiMulti.addAP("SSID", "PW");
  while(WiFiMulti.run() != WL_CONNECTED){delay(10);}
  Serial.println("Connected to AP!");
}

void loop()
{
WiFiClient *pStream;
HTTPClient http;
unsigned int time;

  time = millis();
  http.begin("http://www.boerse-frankfurt.de/index/zugehoerige-werte/DAX");
  if(http.GET() == HTTP_CODE_OK)
  {
    pStream = http.getStreamPtr();
    if (pStream->find("Vonovia"))
    {
      time = millis() - time;
      Serial.println();
      Serial.print("Finding the String \"Vonovia\" in \"http://www.boerse-frankfurt.de/index/zugehoerige-werte/DAX\" took ");
      Serial.print(time);
      Serial.println(" ms");
    }
    else Serial.println("String not found!");
  }
  else Serial.println("Unable to connect to server!");
  http.end();
  delay(10000);
}
I also tried a byte by byte comparison via "pStream->readBytes(&buff, 1);", but the same speed difference!
Any idea how to speed up the search for strings in websites on an ESP32?
Thanks for the answers in advance!

Re: ESP32 slower than ESP8266

Posted: Sun Mar 04, 2018 4:47 pm
by tele_player
Interesting.
I ran that code on 8266 and esp32, and times were about the same on both. About 10000 to 11000ms.

Re: ESP32 slower than ESP8266

Posted: Sun Mar 04, 2018 8:13 pm
by Joegi_Lov
Strange. I ran it again, but still the same (different speed) results! Could my AP have something to do with the different speeds?

Re: ESP32 slower than ESP8266

Posted: Sun Mar 04, 2018 8:23 pm
by Joegi_Lov
It might also be of interest that I'm using a LOLIN32 (ESP32) and a WEMOS MINI (ESP8266)!

Re: ESP32 slower than ESP8266

Posted: Sun Mar 11, 2018 3:31 pm
by Joegi_Lov
You can also try the "StreamHttpClient"-example and remove all "USE_SERIAL" (as the serial output else would be the bottleneck) and time the loop. You will see that the ESP8266 is much faster (with any website), or better to say that the ESP32 is very slow!