Message105868
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. |
|
Date |
User |
Action |
Args |
2010-05-16 14:25:08 | flox | set | recipients:
+ flox, jepler, rhettinger, tseaver, orsenthil, pitrou, ajaksu2 |
2010-05-16 14:25:07 | flox | set | messageid: <1274019907.17.0.204049143468.issue1285086@psf.upfronthosting.co.za> |
2010-05-16 14:25:05 | flox | link | issue1285086 messages |
2010-05-16 14:25:04 | flox | create | |
|