Kristján Valur Jónsson wrote:
-----Original Message-----
From: python-dev-bounces+kristjan=ccpgames....@python.org
[mailto:python-dev-bounces+kristjan=ccpgames....@python.org] On
Behalf Of mar...@v.loewis.de
Sent: 24. apríl 2012 17:44
To: python-dev@python.org
Subject: Re: [Python-Dev] cpython: Implement PEP 412: Key-sharing
dictionaries (closes #13903)
Benchmarks should measure memory usage too, of course. Sadly that is
not possible in standard cPython.
It's actually very easy in standard CPython, using sys.getsizeof.
Yes, you can query each python object about how big it thinks it is.
What I'm speaking of is more like:
start_allocs, start_mem = allocator.get_current()
allocator.reset_limits()
run_complicated_tests()
end_allocs, end_mem = allocator.get=current()
Print "delta blocks: %d, delta mem: %d"%(end_allocs-start_allocs,
end_mem-start_mem)
print "peak blocks: %d, peak mem: %d"%allocator.peak()
Take a look at the benchmark suite at
http://hg.python.org/benchmarks/
The test runner has an -m option that profiles memory usage,
you could take a look at how that is implemented
Cheers,
Mark.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com