Antoine Pitrou added the comment: Victor, your benchmark is buggy (it writes one character at a time). You should apply the following patch:
$ diff -u bench_stringio_orig.py bench_stringio.py --- bench_stringio_orig.py 2012-08-11 12:02:16.528321958 +0200 +++ bench_stringio.py 2012-08-11 12:05:53.939536902 +0200 @@ -41,8 +41,8 @@ ('bmp', '\u20ac' * k + '\n'), ('non-bmp', '\U0010ffff' * k + '\n'), ): - bench.bench_func('writer long lines %s' % charset, writer, n // k, text) - bench.bench_func('writer-reader long lines %s' % charset, writer_reader, n // k, text) + bench.bench_func('writer long lines %s' % charset, writer, n, [text]) + bench.bench_func('writer-reader long lines %s' % charset, writer_reader, n, [text]) for charset, text in ( ('ascii', 'a' * (n // 10) + '\n'), @@ -50,8 +50,8 @@ ('bmp', '\u20ac' * (n // 10) + '\n'), ('non-bmp', '\U0010ffff' * (n // 10) + '\n'), ): - bench.bench_func('writer very long lines %s' % charset, writer, 10, text) - bench.bench_func('writer-reader very long lines %s' % charset, writer_reader, 10, text) + bench.bench_func('writer very long lines %s' % charset, writer, 100, [text]) + bench.bench_func('writer-reader very long lines %s' % charset, writer_reader, 100, [text]) data = 'abc\n' * n bench.bench_func('reader ascii', reader, data) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15612> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com