[MERGE] Read .kndx files in pyrex
John Arbash Meinel
john at arbash-meinel.com
Fri Jun 29 02:13:52 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
The attached patch is an update to my earlier work. It implements
'KnitIndex._load_data' in pyrex. This is a pretty substantial win for anything
which has to read from a repository. Because anything that does ends up reading
inventory.kndx to get the ancestry graph.
I'm pretty sure this conforms to our final decisions on pyrex code:
1) It doesn't version the .c file
2) It uses a "_foo_py.py" python implementation and a "_foo_c.pyx" pyrex
3) The direct tests for KnitIndex are factored so that they are run against
It also adds a direct test for Martin's KnitCorrupt fix. Which I was surprised
was not added when he did his work.
As far as specific effect...
If I modify "NEWS" and then run "time bzr diff", this patch saves approximately
250ms. (1s without, 0.75s with the patch).
Without any changes it has no effect on 'bzr diff' because we don't need to
read any .kndx files. In the case of NEWS, we actually need to read 2 (one for
inventory.kndx and one for NEWS.kndx). And NEWS is pretty big, but still about
10x smaller than inventory.kndx.
One thing that this *doesn't* do is work out how Release Managers are supposed
to make sure that the final release tarball has the .c files necessary for
One other thing I ran into, which I *don't* really know how to fix. In the
pyrex code, I'm doing:
raise IndexError('This was an error')
Which works fine on my Mac, and on my server (python 2.4.3, and pyrex 0.9.5.1a
for both). However when using Fiesty with python 2.5.1 and pyrex 0.9.4.1 I get
TypeError: exceptions must be strings, classes, or instances, not
As near as I can tell, this is a bug in python2.5, because the generated C cod
is identical. It is using "index_error = __builtin__.get('IndexError')" and
then effectively doing "error = index_error(Args); raise error"
I don't see how that is wrong, even in python2.5.
Anyone have any ideas? (I'm guessing this will be an issue because I think the
PQM is using fiesty, which means the test suite will fail there.)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the bazaar