Strangely slow execution
Posted: Fri Aug 14, 2015 12:38 pm
I just started playing with the Adafruit HUZZAH. I ported code that worked just fine on an Arduino Uno with a Ethernet shield. I thought With an 80 MHz CPU, this should be really fast on the HUZZAH. I saw very slow performance. I put in some print statements using the millis() millisecond timer and here is what I saw. I must be doing something incredibly dumb. I'm a rather experience programmer, but don't have a clue how this could take so long. I notice that my supplied User-Agent should probably be changed, but there are definitely performance problems before I get to that line.
I have opened a connection to my WiFi with WiFi.begin(...).
The variable client is a WebClient that I connect to my server with client.connect(...)
I am sending a POST to ReportStationInfo.php on that client. I have placed my POST data into a string named tmp.
The statements below are used to pass the data to the web. The number at the beginning of the line is the number of msecs taken to execute that line of code.
404 client.println("POST /cue/ReportStationInfo.php HTTP 1.1");
419 client.println("Host: 192.150.23.115");
445 client.println("Connection: keep-alive");
419 client.println("User-Agent: arduino-ethernet");
432 client.println("Accept: application/json");
411 client.println("Content-Type: application/x-www-form-urlencoded");
209 client.print("Content-Length: ");
420 client.println(strlen(tmp));
215 client.println();
550 client.print(tmp);
200 client.println();
You can execute a hell of a lot of statments on a 80 MHz CPU in 400 msec. The network is at least 10 MB/sec, so not much time is required to send the data. What could be going on?
I have opened a connection to my WiFi with WiFi.begin(...).
The variable client is a WebClient that I connect to my server with client.connect(...)
I am sending a POST to ReportStationInfo.php on that client. I have placed my POST data into a string named tmp.
The statements below are used to pass the data to the web. The number at the beginning of the line is the number of msecs taken to execute that line of code.
404 client.println("POST /cue/ReportStationInfo.php HTTP 1.1");
419 client.println("Host: 192.150.23.115");
445 client.println("Connection: keep-alive");
419 client.println("User-Agent: arduino-ethernet");
432 client.println("Accept: application/json");
411 client.println("Content-Type: application/x-www-form-urlencoded");
209 client.print("Content-Length: ");
420 client.println(strlen(tmp));
215 client.println();
550 client.print(tmp);
200 client.println();
You can execute a hell of a lot of statments on a 80 MHz CPU in 400 msec. The network is at least 10 MB/sec, so not much time is required to send the data. What could be going on?