mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Use bytes join fast path for large states payload (#110694)
b"".join has a fast path for when there are more than two bytes-strings
to combine
f383ca1a6f/Objects/stringlib/join.h (L123)
This commit is contained in:
parent
37897ee384
commit
9cf45882a7
@ -222,7 +222,7 @@ class APIStatesView(HomeAssistantView):
|
|||||||
if entity_perm(state.entity_id, "read")
|
if entity_perm(state.entity_id, "read")
|
||||||
)
|
)
|
||||||
response = web.Response(
|
response = web.Response(
|
||||||
body=b"[" + b",".join(states) + b"]",
|
body=b"".join((b"[", b",".join(states), b"]")),
|
||||||
content_type=CONTENT_TYPE_JSON,
|
content_type=CONTENT_TYPE_JSON,
|
||||||
zlib_executor_size=32768,
|
zlib_executor_size=32768,
|
||||||
)
|
)
|
||||||
|
@ -356,7 +356,9 @@ def _send_handle_get_states_response(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Send handle get states response."""
|
"""Send handle get states response."""
|
||||||
connection.send_message(
|
connection.send_message(
|
||||||
construct_result_message(msg_id, b"[" + b",".join(serialized_states) + b"]")
|
construct_result_message(
|
||||||
|
msg_id, b"".join((b"[", b",".join(serialized_states), b"]"))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user