ESP32 slower than ESP8266

Joegi_Lov
Posts: 9
Joined: Tue Feb 27, 2018 7:07 pm

ESP32 slower than ESP8266

Postby Joegi_Lov » Tue Feb 27, 2018 9:08 pm

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!

Joegi_Lov
Posts: 9
Joined: Tue Feb 27, 2018 7:07 pm

Re: ESP32 slower than ESP8266

Postby Joegi_Lov » Wed Feb 28, 2018 2:19 pm

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!

tele_player
Posts: 90
Joined: Sun Jul 02, 2017 3:38 am

Re: ESP32 slower than ESP8266

Postby tele_player » Thu Mar 01, 2018 3:59 am

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.

Joegi_Lov
Posts: 9
Joined: Tue Feb 27, 2018 7:07 pm

Re: ESP32 slower than ESP8266

Postby Joegi_Lov » Sat Mar 03, 2018 8:51 pm

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!

tele_player
Posts: 90
Joined: Sun Jul 02, 2017 3:38 am

Re: ESP32 slower than ESP8266

Postby tele_player » Sun Mar 04, 2018 4:47 pm

Interesting.
I ran that code on 8266 and esp32, and times were about the same on both. About 10000 to 11000ms.

Joegi_Lov
Posts: 9
Joined: Tue Feb 27, 2018 7:07 pm

Re: ESP32 slower than ESP8266

Postby Joegi_Lov » Sun Mar 04, 2018 8:13 pm

Strange. I ran it again, but still the same (different speed) results! Could my AP have something to do with the different speeds?
Last edited by Joegi_Lov on Sun Mar 04, 2018 10:12 pm, edited 2 times in total.

Joegi_Lov
Posts: 9
Joined: Tue Feb 27, 2018 7:07 pm

Re: ESP32 slower than ESP8266

Postby Joegi_Lov » Sun Mar 04, 2018 8:23 pm

It might also be of interest that I'm using a LOLIN32 (ESP32) and a WEMOS MINI (ESP8266)!

Joegi_Lov
Posts: 9
Joined: Tue Feb 27, 2018 7:07 pm

Re: ESP32 slower than ESP8266

Postby Joegi_Lov » Sun Mar 11, 2018 3:31 pm

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!

Who is online

Users browsing this forum: lbernstone and 85 guests