-
Notifications
You must be signed in to change notification settings - Fork 7.6k
WebServer.handleClient() longer time execution on ESP32-C3 compares to ESP8266 (930 us vs 10us) #7708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Owiec94 - |
Sure, I've pasted basic code in 1st post (without my stuff) which still generating long time execution - tested before paste here. If You need any additional info feel free to write, I'll do my best. Hope that helps quickly optimize that function. Thank You |
@SuGlider any chances to fix it? Should I provide any info to help solve that problem? |
Yes, I'll work on it soon, in a couple of weeks. |
I ran in to this same issue and posted an easily recreatable (is that a word) example on Reddit. This issue affects ALL ESP32 boards so the title may need to be updated. With
The issue only crops up when Whoever implemented this planned for this, because it can be disabled with |
Attached is the script I use to test this: blink-web.ino.gz. FWIW while simply adding
Step 1 should be removing that arbitrary delay (or making |
Sorry for late response, temporary workaround is to call server.enableDelay(false); and call webserver.handle() every 1ms using timer. Now on ESP32-C3 we have 20us executing time - much much better but not perfect. |
I'm the person that implemented enableDelay. The reasoning there was that the vast majority of examples on the net do not put any sort of delay in the loop. This causes loop to block any other activity in spawned threads, and so there were lots of issues that would come up about that, which is difficult to track down and fatal. I knew this could slow down the process if you have a lot of other processing in the loop (hence enableDelay), but in reality, a delay of 10 ms is fairly trivial, and handling over 1000 transactions per second is not behavior that should be encouraged. |
The issue as I see it is that a person could have a project that has a working requirement of 20kHz, they add in Wouldn't it make more sense to |
arduino-esp32/libraries/WebServer/src/WebServer.cpp Lines 350 to 352 in 0260cd6
there is something like a |
Closing since not an issue. Implementation is different for esp8266 and esp32 |
I understand the implementations are different, but I think a good target goal would at least be similar performance. This is pretty limiting for MOST applications. Closing it as WONTFIX doesn't help anyone. |
@scottchiefbaker they are very different in implementation and can never get even close. There are multiple levels of things between RAW LwIP (what the 8266 is based on) and sockets (what ESP32 is based on) and also there is FreeRTOS on ESP32. Something with similar performance is the AsyncWebServer that works on both and does not even have |
Board
ESP32-C3
Device Description
ESP32-C3 DevKitM-1
Hardware Configuration
GPIO 19 as a test for Logic Analyzer software
Version
latest master (checkout manually)
IDE Name
PlatformIO
Operating System
Windows 10 x64
Flash frequency
mode:DOUT, clock div:1
PSRAM enabled
yes
Upload speed
ota
Description
Im using WebServer.handleClient() to manage GET commands with parameters in URL. This function on ESP32 takes 90 times longer compares to ESP8266.

My method of testing:
with Logic analyzer.
platform = espressif32
board = esp32-c3-devkitm-1
test with few handlers (webServer.on("/setParams"......):

933us
test without any handlers, just webServer.init():

933us
platform = espressif8266

board = esp07
test with few handlers:
11.88us
test without any handlers, just init:

11.88us
ESP32-C3 needs 933us compares to 11us on ESP8266 which is 90x timer slower than older chips. In my solution time is critical and I had to slow down other peripherals (to prevent overflow buffers), which affects essential on performance.
Sketch
Debug Message
Other Steps to Reproduce
This long time execution doesnt matter if WiFi is connected or not, also doesnt matter if we called before webServer.init() or not.
Both chips are clocked 160MHz.
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: