Florent Xicluna <florent.xicl...@gmail.com> added the comment: Updated script for benchmarks (on 2.x and 3.x). Inspired by the "Tools/iobench" script.
It benchmarks various quote/unquote implementations on 2.x and 3.x. On 2.7 the fastest implementation is something like: def quote(s): if not s or not s.rstrip(safe): return s return ''.join(map(safe_get, s)) On 3.2 the fastest implementation uses list comprehension: def quote_from_bytes(s): if not s: return '' if not s.rstrip(safe): return s.decode() return ''.join([quoter(c) for c in s]) Note: the regexp implementation is slower in both cases. ---------- Added file: http://bugs.python.org/file17365/quotebench.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1285086> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com