[MERGE] 10-15% faster inventory serialisation but changes canonical form

Robert Collins robertc at robertcollins.net
Wed Sep 12 23:25:31 BST 2007


This patch does several things.

Firstly, performance:
First line is without, second is with the patch:
running 5 tests...
bench_xml.BenchXMLSerializer.test_read_from_string_cached_kernel_like_inventory OK      710ms/   47337ms
OK      708ms/   51961ms
          2ms
          
bench_xml.BenchXMLSerializer.test_read_from_string_kernel_like_inventory
OK      702ms/   38754ms
OK      711ms/   43121ms
         -9ms
bench_xml.BenchXMLSerializer.test_write_kernel_like_inventory
OK      376ms/   32830ms
OK      339ms/   44003ms
         37ms
bench_xml.BenchXMLSerializer.test_write_to_string_cached_kernel_like_inventory  OK      238ms/   30509ms
OK      198ms/   31669ms
         40ms
bench_xml.BenchXMLSerializer.test_write_to_string_kernel_like_inventory 
OK      376ms/   31979ms
OK      329ms/   48898ms
         47ms

So not a huge win, but a consistent win all the same.

I think we are very close to our best possible xml serialisation
performance. I was investigating this to see how much of the initial
commit case was in inventory serialisation in real world terms.

The next change this makes is that it stops accepting bad data - file's
without sha1's, symlinks without targets etc. It does this as a side
effect of specialising the serialisation by kind which lets less
comparisons be made.

I've left the _append_revision method present for possible subclasses,
but I'd also be happy to just remove it. This seems a rather unlikely
part of the code base to be getting third party reuse on.

The final thing this does is that it moves all the per-kind data to the
end of the line, with the entry generic data at the start of the line.
This is due to consolidating the data. However it does mean that the
first commit with this serialiser will generate a diff on any line that
represents an executable file.

-Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bzr-mail-ZEiur8.patch
Type: text/x-patch
Size: 15099 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070913/8c1f3f5c/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070913/8c1f3f5c/attachment-0001.pgp 


More information about the bazaar mailing list