MCPcopy
hub / github.com/locustio/locust / _fast_users_on_workers_copy

Method _fast_users_on_workers_copy

locust/dispatch.py:391–397  ·  view source on GitHub ↗

deepcopy is too slow, so we use this custom copy function. The implementation was profiled and compared to other implementations such as dict-comprehensions and the one below is the most efficient.

(users_on_workers: dict[str, dict[str, int]])

Source from the content-addressed store, hash-verified

389
390 @staticmethod
391 def _fast_users_on_workers_copy(users_on_workers: dict[str, dict[str, int]]) -> dict[str, dict[str, int]]:
392 """deepcopy is too slow, so we use this custom copy function.
393
394 The implementation was profiled and compared to other implementations such as dict-comprehensions
395 and the one below is the most efficient.
396 """
397 return dict(zip(users_on_workers.keys(), map(dict.copy, users_on_workers.values())))

Callers 3

__init__Method · 0.95
__next__Method · 0.95
new_dispatchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected