Optimize `get_comm_cost` (#4328)
Optimize `get_comm_cost` (#4328)

Instead of using a generator expression to build out a `list` and `sum`
it, simply iterate through each object and accumulate the total
ourselves. In Cython this works out to be a `for`-loop roughly with the
addition itself occurring just the same in C.
dask/distributed,dask/distributed,dask/distributed,dask/distributed