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!
ESP32 slower than ESP8266
Re: ESP32 slower than ESP8266
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!
-
- Posts: 90
- Joined: Sun Jul 02, 2017 3:38 am
Re: ESP32 slower than ESP8266
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.
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
The following code (searching for a string in a website) takes <2000ms on a ESP8266 and >9500ms (~5 times slower) on a ESP32:
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!
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);
}
Any idea how to speed up the search for strings in websites on an ESP32?
Thanks for the answers in advance!
-
- Posts: 90
- Joined: Sun Jul 02, 2017 3:38 am
Re: ESP32 slower than ESP8266
Interesting.
I ran that code on 8266 and esp32, and times were about the same on both. About 10000 to 11000ms.
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
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.
Re: ESP32 slower than ESP8266
It might also be of interest that I'm using a LOLIN32 (ESP32) and a WEMOS MINI (ESP8266)!
Re: ESP32 slower than ESP8266
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: No registered users and 138 guests