Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By draco
#15186
martinayotte wrote:I saw this latency is with any WifiClient.print(), println() or write().
So, personally, I'm concatenating as much as I can into a single String object, and then send the whole thing using client.print(str) ...



Yes. In fact, according to some further tests I did, it appears to be TWICE as bad with .println(); my tests show a 125ms latency with .print() and .write(), but a 250ms latency with .println().

So, it's TWICE as fast to do client.print(myString + "\n") as it is to do client.println(myString). Yuck!
I haven't looked into the code, but I imagine that .println() is simply calling a .print() on the original input string, then a second .print("\n").
User avatar
By martinayotte
#15195 Indeed, Yurk !
I've seen this ugly latency in IPAddress.printTo() where it needs 7 print() to send IP address string. (it takes more than 1 sec)
I decided to add a IPAddress.toCharArray() function and send the whole thing in a single print().
I hope we get a fix soon for this latency ... :?