Skip to content

Commit

Permalink
Only call frame_split_size when there are frames (#3996)
Browse files Browse the repository at this point in the history
This just becomes a no-op if an empty list is given (returning an empty
list). However there is no need to do this work if we don't need it. So
simply restrict calling `frame_split_size` to the case where frames are
present and compression will occur.
  • Loading branch information
jakirkham authored Jul 31, 2020
1 parent e5c544b commit 80ea63a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion distributed/protocol/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ def serialize_bytelist(x, **kwargs):
header, frames = serialize(x, **kwargs)
if "lengths" not in header:
header["lengths"] = tuple(map(nbytes, frames))
frames = sum(map(frame_split_size, frames), [])
if frames:
frames = sum(map(frame_split_size, frames), [])
compression, frames = zip(*map(maybe_compress, frames))
else:
compression = []
Expand Down

0 comments on commit 80ea63a

Please sign in to comment.