Message135797
Benchmark:
a) ./python -m timeit "(b'\xc3\xa9' * 10000).decode('utf-8')"
b)./python -m timeit "(''.join( map(chr, range(0, 128)) )*1000).encode('utf-8')"
c) ./python -m timeit "f=open('Misc/ACKS', encoding='utf-8'); acks=f.read(); f.close()" "acks.encode('utf-8')"
d) ./python -m timeit "f=open('Misc/ACKS', 'rb'); acks=f.read(); f.close()" "acks.decode('utf-8')"
Original -> patched (smallest value of 3 runs):
a) 85.8 usec -> 83.4 usec (-2.8%)
b) 548 usec -> 688 usec (+25.5%)
c) 132 usec -> 144 usec (+9%)
d) 65.9 usec -> 67.3 usec (+2.1%)
Oh, decode 2 bytes sequences are faster with my patch. Strange :-)
But 25% slower to encode a pure ASCII text is not a good news. |
|
Date |
User |
Action |
Args |
2011-05-11 19:48:54 | vstinner | set | recipients:
+ vstinner, lemburg, georg.brandl, phr, belopolsky, moese, ezio.melotti |
2011-05-11 19:48:54 | vstinner | set | messageid: <1305143334.78.0.904172704404.issue2857@psf.upfronthosting.co.za> |
2011-05-11 19:47:54 | vstinner | link | issue2857 messages |
2011-05-11 19:47:54 | vstinner | create | |
|