I have a simple task: in addition to measuring the time it takes to execute a chunk of code in Python, I need to measure the amount of memory a given chunk of code needs.
IPython has a nice utility called timeit
which works like this:
In [10]: timeit 3 + 3
10000000 loops, best of 3: 24 ns per loop
What I'm looking for is something like this:
In [10]: memit 3 + 3
10000000 loops, best of 3: 303 bytes per loop
I'm aware that this probably does not come built in with IPython—but I like the timeit
-memit
analogy.
timeit
,memit
or even "ipython" whatsoever. – Costrel