This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author flox
Recipients ajaksu2, flox, jepler, orsenthil, pitrou, rhettinger, tseaver
Date 2010-05-16.14:25:01
SpamBayes Score 0.00026386065
Marked as misclassified No
Message-id <1274019907.17.0.204049143468.issue1285086@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-05-16 14:25:08floxsetrecipients: + flox, jepler, rhettinger, tseaver, orsenthil, pitrou, ajaksu2
2010-05-16 14:25:07floxsetmessageid: <1274019907.17.0.204049143468.issue1285086@psf.upfronthosting.co.za>
2010-05-16 14:25:05floxlinkissue1285086 messages
2010-05-16 14:25:04floxcreate