STINNER Victor added the comment: guard_benchmark.patch: patch adding a _testcapi.guard_benchmark(), a microbenchmark on dictionary guard. The benchmark measures the cost of checking if a dictionary key was modified.
Run the benchmark with attached guard_benchmark.py. Result on my PC: * PyObject_GetItem(): 10.2 ns * PyDict_GetItem(): 9.1 ns * guard->check(): 2.9 ns python3 -m platform: Linux-4.2.8-300.fc23.x86_64-x86_64-with-fedora-23-Twenty_Three You have to modify manually _testcapi.c to choose between the 3 implementations. guard_benchmark.patch requires the issue #26098 patch and the fat module which implements fat.GuardDict. The fat module can be found at: https://github.com/haypo/fat ---------- Added file: http://bugs.python.org/file41604/guard_benchmark.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26058> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com