• M
    Speed up upload by a factor of 17 (#4787) · 7e8993fc
    Mitch Bradley 提交于
    * Speed up upload by a factor of 17
    
    Uploads are very slow because of an unnecessary "client.connected()" check in _uploadReadByte().
    
    Here is what happens:
    client.connected() is called for every byte read.  WiFiClient::connected() calls recv(fd(), &dummy, 0, MSG_DONTWAIT); which takes a relatively long time, so the optimized path of returning a buffered byte via client.read() is effectively nullified.
    
    Removing the one line changed the upload speed for a 2 MB file (discarding the received data) from 22 KB/sec (before) to 367 KB/sec (after).
    
    The change is safe in the face of disconnects because client.read(), when it no longer has buffered data, calls (WiFiClient)  fillBuffer(), which calls recv(), so the disconnection will be detected in due course.
    
    * Move disconnect check into the timeout loop
    7e8993fc
Parsing.cpp 18.9 KB