[PATCH 3 of 6] Pure python base85 fallback

Mads Kiilerich mads at kiilerich.com
Mon Jan 12 20:27:15 CST 2009


Martin Geisler wrote, On 01/12/2009 06:39 PM:
> # HG changeset patch
> # User Brendan Cully <brendan at kublai.com>
> # Date 1230692338 28800
> # Node ID 0478c0812827f5265991133b5ff456052902a54f
> # Parent  7c8d8bfcb0549a5191b8cc313909db3320d30f3a
> Pure python base85 fallback
>
> Encoding takes about 100x longer than native on a large binary.
>   

A couple of tricks makes it 3 times faster ... but still 40 times slower 
than c:


_b85chars2 = [(a + b) for a in _b85chars for b in _b85chars]

...

    out = ''.join(_b85chars[(word / 52200625) % 85] +
                  _b85chars2[(word / 7225) % 7225] +
                  _b85chars2[word % 7225]
                  for word in words)


/Mads

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3435 bytes
Desc: S/MIME Cryptographic Signature
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090113/73d0f1a6/attachment.bin 


More information about the Mercurial-devel mailing list