[MERGE] Pyrex RIO implementation

Jelmer Vernooij jelmer at samba.org
Thu May 14 17:33:37 BST 2009


This patch adds a Pyrex implementation of RIO that is faster than the
current implementation of RIO in "plain" Python. This is my first
Pyrex extension for Bazaar so I hope I've updated all the right places
:-)

The RIO tests pass with this patch, and with my RIOSerializer patch
and this patch merged I now get faster deserialization using RIO than
using XML:

<bzrlib.chk_serializer.CHKRIOSerializer object at 0x2bd8790>: 4.877576
<bzrlib.xml8.Serializer_v8 object at 0x2bcc890>: 5.504792

generated using the following plugin:

#!/usr/bin/python

import time
from bzrlib.xml8 import serializer_v8
from bzrlib.chk_serializer import chk_rio_serializer
from bzrlib.revision import Revision
from bzrlib.commands import Command, register_command

rev = Revision('foo')
rev.committer = "Joe Committer <joe at example.com>"
rev.properties['author'] = "BAR"
rev.message = "fdjklhfksdjh sdjkh dksjh fsdkh sdjkfhsdkjfhsdkfhjkh fsdjkh fksdjh fdksjh fsdjkh djkh fsdkj fhsdkjfh sdiufhieuh fiweuh fieuh fuih " * 20
rev.timestamp = 4324234234
rev.inventory_sha1 = "32432d323e32e23e32e"
rev.timezone = 300

class cmd_bench_serializer(Command):

    def _bench(self, serializer, text, times):
        t = time.time()
        for i in xrange(times):
            serializer.read_revision_from_string(text)
        self.outf.write("%r: %f\n" % (serializer, time.time() - t))

    def run(self):
        text = chk_rio_serializer.write_revision_to_string(rev)
        self._bench(chk_rio_serializer, text, 100000)

        text = serializer_v8.write_revision_to_string(rev)
        self._bench(serializer_v8, text, 100000)

register_command(cmd_bench_serializer)

I'm not sure how representative this is for "real" revisions, so it
would be nice to try it in a real-world scenario again.

Cheers,

Jelmer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rio-c-4361.patch
Type: text/x-diff
Size: 21881 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090514/a90ecc76/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090514/a90ecc76/attachment-0001.pgp 


More information about the bazaar mailing list