Hey Jake,

From the source of shared_memory.py, sum() is invoked on _allocated_bytes, which is a tuple of ints. So, while the complexity of sum() is O(n), the operation should be rather fast at n=99,999, e.g., timeit.timeit(‘sum(tuple([0] * 99999))’, number=1) took 0.001508065004600212s on my computer. Hence, I doubt if sum() operation is the reason for the slowdown.

Written by

Programming, experimenting, writing | Past: SWE, Researcher, Professor | Present: SWE

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store