[merge] Improved XML Writer (5-10x faster)
John Arbash Meinel
john at arbash-meinel.com
Thu Aug 17 00:54:28 BST 2006
Well, I looked into Robert's work on updating the XML serializer to have
a custom writer, rather than going through ElementTree's slow writer.
And it turns out, we can take a 2s operation (to write out a 10K tree),
and make it all the way down to a 250-400ms operation.
I was even able to preserve the ElementTree property that writing the
XML uses numeric entity references, rather than using real UTF-8 encoding.
This means that the change is fully compatible with old versions of bzr.
Because of the --cache-dir flag, you can also substitute a real kernel
tree into the benchmarks. So I've done that.
These are my results:
2044ms kernel_like_tree write_inventory()
365ms kernel_like_tree custom write_inventory()
281ms kernel_like_tree custom cached write_inventory()
5029ms real_kernel_tree write_inventory()
1050ms real_kernel_tree custom write_inventory()
786ms real_kernel_tree custom cached write_inventory()
The 'cached' write is writing out the same inventory a second time. With
the Unicode => encoded_entity mapping already saved. I don't know if we
want to clear out the cache at the end of writing the inventory, I've
commented out the function that does it, so that I can do my tests.
The only time it is really useful is when we write an inventory to the
repository, and then turn around and write the basis inventory. Since a
lot of the file_id and path stuff will be cached.
I think it would be nice to see this merged for 0.10.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: custom_xml_writer.diff
Type: text/x-patch
Size: 18773 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060816/f431a754/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060816/f431a754/attachment.pgp
More information about the bazaar
mailing list