[IPython-User] Neat trick: Quick memory usage benchmarking in IPython
Sun Jul 1 12:24:07 CDT 2012
On Sat, Jun 30, 2012 at 6:20 PM, Fernando Perez <email@example.com> wrote:
> using the new magics api:
> let's test this out, and if it works well we may just ship it.
It looks like it's handy function simplifying memory_profiler usage,
but I won't vote for shipping if my vote counts.
It requires additional module (perhaps popular one and tiny, but
nonetheless), which requires yet additional module - psutil (optional
on Linux but recommended and necessary on Windows).
Introducing two new modules as a new dependency for single handy
function may be seen as too much to otherwise sensitive application as
IPython is toward as minimal requirement as possible, while offering
so much. This is IMHO clear line between IPython and various similar
Also script needs to be corrected for Python3 compatibility.
I understand that I should just copy the script in IPython interpreter
and can test it? If that's correct here is what I got on Ubuntu with
In : %memit np.ones(1e6)
best of 3: 0.117188 MB per loop
which is different from result author got for some reason, while
profiling it with memory_profiler I get expected result.
On Windows I get this traceback: http://pastebin.com/Mmc7mHQh
Anyhow I'd vote to put this script in IPython wiki, where other
interesting magic functions can be hosted perhaps
More information about the IPython-User