Skip to content
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

Improve performance for high-overhead clients #91

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

opticron
Copy link

While trying to write a printer to render objects directly to a web stream, I encountered these performance issues. Rendering time went from >1.5s to <0.4s with these changes due to reduction in the number of calls into the web client interface.

Kinsey Moore added 4 commits February 24, 2018 01:08
Don't send a single quote as a string. This could cause extra processing
in downstream clients.
This allows faster processing of empty strings ("") and doesn't burden
downstream clients with processing "".
This allows strings to be passed as is instead of being decomposed into
individual characters. This is more efficient for some clients and those
that don't implement it can fall back on the default print
implementation.
This pushes strings without characters that need to be escaped directly
to the Print implementation instead of decomposing them anyway. This can
greatly improve performance for clients with significant per-call
overhead.
opticron pushed a commit to opticron/ESP8266HueEmulator that referenced this pull request Apr 29, 2018
This removes the requirement to modify the aJson library to get a larger
buffer. The default method allocates a buffer for rendering JSON
dynamically based on output size. A new method has also been added for
applications with less available SRAM (setBufferlessResponses). This
requires no large fixed or dynamic buffer, but increases response
rendering time by close to two orders of magnitude due to inefficiencies
and overhead in the WiFiClient and aJson. With the following PR in
place, this is reduced to an order of magnitude difference (50ms vs
400ms for /api): interactive-matter/aJson#91
opticron pushed a commit to opticron/ESP8266HueEmulator that referenced this pull request Apr 30, 2018
This removes the requirement to modify the aJson library to get a larger
buffer. The default method allocates a buffer for rendering JSON
dynamically based on output size. A new method has also been added for
applications with less available SRAM (setBufferlessResponses). This
requires no large fixed or dynamic buffer, but increases response
rendering time by close to two orders of magnitude due to inefficiencies
and overhead in the WiFiClient and aJson. With the following PR in
place, this is reduced to an order of magnitude difference (50ms vs
400ms for /api): interactive-matter/aJson#91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant