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:
J. Nick Koston
2024-02-16 00:58:11 -06:00
committed by GitHub
parent 37897ee384
commit 9cf45882a7
2 changed files with 4 additions and 2 deletions

View File

@ -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"]"))
)
)