STINNER Victor added the comment: I added a new _PyUnicodeWriter_WriteASCIIString() function to reply to Serhiy's comment on Rietveld: "Perhaps it will be worth to add a helper function or macros _PyUnicodeWriter_WriteTwoAsciiChars()?"
changeset: 87263:d1ca05428c38 user: Victor Stinner <victor.stin...@gmail.com> date: Tue Nov 19 12:54:53 2013 +0100 files: Include/unicodeobject.h Objects/listobject.c Objects/unicodeobject.c Python/formatter_unicode.c description: Add _PyUnicodeWriter_WriteASCIIString() function Using this function, there is no need to create temporary colon (": ") or sep (", ") strings, performances are a little better with the final commit. Common platform: Timer info: namespace(adjustable=False, implementation='clock_gettime(CLOCK_MONOTONIC)', monotonic=True, resolution=1e-09) CFLAGS: -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes Timer: time.perf_counter Platform: Linux-3.9.4-200.fc18.x86_64-x86_64-with-fedora-18-Spherical_Cow Python unicode implementation: PEP 393 CPU model: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz Bits: int=32, long=64, long long=64, size_t=64, void*=64 Platform of campaign pyaccu: Python version: 3.4.0a4+ (default:99141ab08e21, Nov 19 2013, 13:10:27) [GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] Timer precision: 39 ns Date: 2013-11-19 13:10:28 SCM: hg revision=99141ab08e21 branch=default date="2013-11-19 12:59 +0100" Platform of campaign writer: Python version: 3.4.0a4+ (default:3a354b879d1f, Nov 19 2013, 13:08:42) [GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] Timer precision: 46 ns Date: 2013-11-19 13:09:20 SCM: hg revision=3a354b879d1f tag=tip branch=default date="2013-11-19 13:07 +0100" --------------------------------------+-------------+-------------- Tests | pyaccu | writer --------------------------------------+-------------+-------------- {"a": 1} | 613 ns (*) | 338 ns (-45%) dict(zip("abc", range(3))) | 1.05 us (*) | 640 ns (-39%) {"%03d":"abc" for k in range(10)} | 635 ns (*) | 447 ns (-30%) {"%100d":"abc" for k in range(10)} | 651 ns (*) | 424 ns (-35%) {k:"a" for k in range(10**3)} | 233 us (*) | 132 us (-44%) {k:"abc" for k in range(10**3)} | 251 us (*) | 154 us (-39%) {"%100d":"abc" for k in range(10**3)} | 668 ns (*) | 412 ns (-38%) {k:"a" for k in range(10**6)} | 268 ms (*) | 158 ms (-41%) {k:"abc" for k in range(10**6)} | 276 ms (*) | 163 ms (-41%) {"%100d":"abc" for k in range(10**6)} | 658 ns (*) | 422 ns (-36%) --------------------------------------+-------------+-------------- Total | 544 ms (*) | 321 ms (-41%) --------------------------------------+-------------+-------------- ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19646> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com