You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the response is using chunked transfer encoding then each of these writes incurs 4 bytes of overhead (\r\n\r\n) plus 1 (or sometimes possibly 2 or 3) more for the chunk length. Since these strings are quite short (many are only 1 byte themselves) this ends up being quite a lot of overhead - as much as 5x for the shortest strings. This is overhead on the size of the response - this data has to be copied around in memory, sent over the network, and interpreted by the client.
In the case of this simple example, the whole response is known synchronously (ie, before renderElement even returns) and there's no reason it couldn't all end up in a single chunk (ie, a single call to Request.write).
For elements containing a Deferred, at least the strings between Deferreds could be combined which still greatly reduces the number of small chunks written (even with every single string coming from a Deferred, it's no worse than the current behavior).
Consider this behavior of
renderElement
:If the response is using chunked transfer encoding then each of these writes incurs 4 bytes of overhead (\r\n\r\n) plus 1 (or sometimes possibly 2 or 3) more for the chunk length. Since these strings are quite short (many are only 1 byte themselves) this ends up being quite a lot of overhead - as much as 5x for the shortest strings. This is overhead on the size of the response - this data has to be copied around in memory, sent over the network, and interpreted by the client.
In the case of this simple example, the whole response is known synchronously (ie, before
renderElement
even returns) and there's no reason it couldn't all end up in a single chunk (ie, a single call to Request.write).For elements containing a Deferred, at least the strings between Deferreds could be combined which still greatly reduces the number of small chunks written (even with every single string coming from a Deferred, it's no worse than the current behavior).
Searchable metadata
The text was updated successfully, but these errors were encountered: