Following up on my task to make it easier to benchmark memory usage in Python, I updated Fabian’s [memory_profiler] to include a couple of useful IPython magics. While in my last post, I used the new IPython 0.13 syntax for defining magics, this time I used the backwards-compatible …
%timeit, there’s no doubt about it. So why not have
something like that, but for measuring how much memory your line takes?
Well, now you can; grab a hold of the script in the following gist and
run it like in the example.
To construct a
vbench benchmark you need a setup string and a code
string. The constructor’s signature is:
Benchmark(self, code, setup, ncalls=None, repeat=3, cleanup=None, name=None, description=None, start_date=None, logy=False).
Why generate benchmarks dynamically?
scikit-learn purposes, the
code string will be …