Skip to content

Instantly share code, notes, and snippets.

@cb-v4s
Last active January 27, 2021 17:25
Show Gist options
  • Select an option

  • Save cb-v4s/1b0c4d2758c23051bf5c241dc466946e to your computer and use it in GitHub Desktop.

Select an option

Save cb-v4s/1b0c4d2758c23051bf5c241dc466946e to your computer and use it in GitHub Desktop.
python script performance
import time, memory_profiler
i_mem = memory_profiler.memory_usage()
start = time.time()
myfunc()
end = time.time()
f_mem = memory_profiler.memory_usage()
elapsed = end - start
mem_diff = f_mem[0] - i_mem[0]
print(f'Finished jobs in {elapsed} consuming a total of {mem_diff} MB to complete')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment