mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +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")
|
||||
)
|
||||
response = web.Response(
|
||||
body=b"[" + b",".join(states) + b"]",
|
||||
body=b"".join((b"[", b",".join(states), b"]")),
|
||||
content_type=CONTENT_TYPE_JSON,
|
||||
zlib_executor_size=32768,
|
||||
)
|
||||
|
@ -356,7 +356,9 @@ def _send_handle_get_states_response(
|
||||
) -> None:
|
||||
"""Send handle get states response."""
|
||||
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