[issue17618] base85 encoding

Martin Morrison report at bugs.python.org
Sun Apr 14 17:51:49 CEST 2013


Martin Morrison added the comment:

I've updated the Ascii85 algorithms to remove the quadratic complexity, and use a single struct.pack/unpack. They should now be much quicker for large input strings.

It's difficult to factor out commonality with b85* because the encodings and rules differ. This is especially true for decode (where Ascii85 allows arbitrary whitespace, so it either has to be stepped through as I've implemented it, or it would have to first be sanitised with .replace() or similar, which is expensive for large inputs). For encode, the special cases supported by Ascii85 make it impossible to *just* use a lookup table, and the simplified algorithm for encoding means it isn't necessary to use one at all. I also wanted to keep the Mercurial code intact as much as possible, so it can be kept in sync in future if necessary.

My notes from the previous diff also still apply if anyone has thoughts on those.

----------
Added file: http://bugs.python.org/file29852/issue17618-3.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17618>
_______________________________________


More information about the Python-bugs-list mailing list