[MERGE] Read .kndx files in pyrex

John Arbash Meinel john at arbash-meinel.com
Fri Jun 29 02:13:52 BST 2007

Hash: SHA1

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
both implementations.

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:

if something:
  raise IndexError('This was an error')

Which works fine on my Mac, and on my server (python 2.4.3, and pyrex
for both). However when using Fiesty with python 2.5.1 and pyrex I get
the error:

	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.)

Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: knit_index_pyrex.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20070628/120c932c/attachment-0001.diff 

More information about the bazaar mailing list