[Python-Dev] cpython: Implement PEP 412: Key-sharing dictionaries (closes #13903) (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Wed Apr 25 20:57:13 CEST 2012
- Previous message: [Python-Dev] cpython: Implement PEP 412: Key-sharing dictionaries (closes #13903)
- Next message: [Python-Dev] cpython: Implement PEP 412: Key-sharing dictionaries (closes #13903)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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: startallocs, startmem = allocator.getcurrent() allocator.resetlimits() runcomplicatedtests() endallocs, endmem = allocator.get=current()
This is easy in a debug build, using sys.getobjects(). In a release build, you can use pympler:
start = pympler.muppy.get_size(pympler.muppy.get_objects()) run_complicated_tests() end = pympler.muppy.get_size(pympler.muppy.get_objects()) print "delta mem: %d" % (end-start)
Regards, Martin
- Previous message: [Python-Dev] cpython: Implement PEP 412: Key-sharing dictionaries (closes #13903)
- Next message: [Python-Dev] cpython: Implement PEP 412: Key-sharing dictionaries (closes #13903)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]