Rev 5372: Document some perf decisions. in http://bazaar.launchpad.net/~jameinel/bzr/2.3-btree-chk-leaf
John Arbash Meinel
john at arbash-meinel.com
Wed Aug 4 00:49:53 BST 2010
At http://bazaar.launchpad.net/~jameinel/bzr/2.3-btree-chk-leaf
------------------------------------------------------------
revno: 5372
revision-id: john at arbash-meinel.com-20100803234937-h7s1qn5mif9k7su6
parent: john at arbash-meinel.com-20100803234618-iqbgjncawrqp1wt1
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.3-btree-chk-leaf
timestamp: Tue 2010-08-03 18:49:37 -0500
message:
Document some perf decisions.
-------------- next part --------------
=== modified file 'bzrlib/_btree_serializer_pyx.pyx'
--- a/bzrlib/_btree_serializer_pyx.pyx 2010-08-03 23:46:18 +0000
+++ b/bzrlib/_btree_serializer_pyx.pyx 2010-08-03 23:49:37 +0000
@@ -455,6 +455,15 @@
key = StaticTuple_New(1)
Py_INCREF(hexxed)
StaticTuple_SET_ITEM(key, 0, hexxed)
+ # This is a bit expensive. To parse 120 keys takes 48us, to return them all
+ # can be done in 66.6us (so 18.6us to build them all).
+ # Adding simple hash() here brings it to 76.6us (so computing the hash
+ # value of 120keys is 10us), Intern is 86.9us (another 10us to look and add
+ # them to the intern structure.)
+ # However, since we only intern keys that are in active use, it is probably
+ # a win. Since they would have been read from elsewhere anyway.
+ # We *could* hang the PyObject form off of the gc_chk_sha1_record for ones
+ # that we have deserialized. Something to think about, at least.
key = StaticTuple_Intern(key)
return key
More information about the bazaar-commits
mailing list