Open proppy opened 7 years ago
@proppy what would be the advantages of using that parser? Would you be able to provide a pull request to use that parser for comparison?
This library is fairly slim and can run on AVR boards like the Uno.
@sandeepmistry This parser looks well tested and used in production by many projects.
@proppy let me phrase the question another way. Have you run into any issues with the parser built-into this library?
Do you have time to test out porting the parser into this Arduino library and comparing code size and memory usage with this library?
@sandeepmistry I didn't went thru the path of porting the library to this parser. But a quick review of the code seems to indicate that it could perform better.
The current parser read byte "one by one": https://github.com/arduino-libraries/ArduinoHttpClient/blob/master/src/HttpClient.cpp#L613
While the http-parser implementation is capable of incrementally parsing byte buffers: https://github.com/nodejs/http-parser/blob/master/http_parser.h#L392
IIRC on "some arduino core" (ESP32, ESP8266) reading a byte could mean a context switch between the main task and another one handling the raw LWIP I/O. (summoning @igrr to confirm).
Fair enough, in addition to comparing code size and memory usage, when could also compare throughput performance.
Just to be clear, this is would be low priority for the maintainers of this library. To really kick things off we'd need a pull request from a member of the community like yourself.
Fair enough, in addition to comparing code size and memory usage, when could also compare throughput performance.
I think robustness and feature parity could also be a factor. There is always a trade-off when re implementing something as complex as an HTTP parser yourself.
Any progress so far?
Have you considered reusing an existing http_parser?
The following imeplementation looks nice and embeddable: https://github.com/nodejs/http-parser/blob/master/http_parser.c