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 vstinner
Recipients ezio.melotti, methane, python-dev, r.david.murray, serhiy.storchaka, vstinner
Date 2015-09-22.09:36:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442914621.21.0.895939680938.issue24870@psf.upfronthosting.co.za>
In-reply-to
Content
Ok, here is a patch which optimizes surrogatepass too.

Result of bench_utf8.py.

Common platform:
CFLAGS: -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
Timer info: namespace(adjustable=False, implementation='clock_gettime(CLOCK_MONOTONIC)', monotonic=True, resolution=1e-09)
CPU model: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
Bits: int=32, long=64, long long=64, size_t=64, void*=64
Timer: time.perf_counter
Platform: Linux-4.1.6-200.fc22.x86_64-x86_64-with-fedora-22-Twenty_Two
Python unicode implementation: PEP 393

Platform of campaign before:
SCM: hg revision=8317796ca004 tag=tip branch=default date="2015-09-22 10:46 +0200"
Python version: 3.6.0a0 (default:8317796ca004, Sep 22 2015, 11:33:04) [GCC 5.1.1 20150618 (Red Hat 5.1.1-4)]
Date: 2015-09-22 11:33:12
Timer precision: 73 ns

Platform of campaign after:
SCM: hg revision=8317796ca004+ tag=tip branch=default date="2015-09-22 10:46 +0200"
Python version: 3.6.0a0 (default:8317796ca004+, Sep 22 2015, 11:31:04) [GCC 5.1.1 20150618 (Red Hat 5.1.1-4)]
Date: 2015-09-22 11:31:58
Timer precision: 54 ns

------------------+-------------+---------------
ignore            |      before |          after
------------------+-------------+---------------
100 x 10**1 bytes | 8.85 us (*) |  857 ns (-90%)
100 x 10**3 bytes |  780 us (*) | 45.5 us (-94%)
100 x 10**2 bytes | 78.7 us (*) | 4.81 us (-94%)
100 x 10**4 bytes | 8.13 ms (*) |  456 us (-94%)
------------------+-------------+---------------
Total             |    9 ms (*) |  507 us (-94%)
------------------+-------------+---------------

------------------+-------------+---------------
replace           |      before |          after
------------------+-------------+---------------
100 x 10**1 bytes |   10 us (*) |  939 ns (-91%)
100 x 10**3 bytes |  898 us (*) | 54.1 us (-94%)
100 x 10**2 bytes | 90.5 us (*) | 5.72 us (-94%)
100 x 10**4 bytes | 9.55 ms (*) |  536 us (-94%)
------------------+-------------+---------------
Total             | 10.6 ms (*) |  597 us (-94%)
------------------+-------------+---------------

------------------+-------------+---------------
surrogateescape   |      before |          after
------------------+-------------+---------------
100 x 10**1 bytes | 10.4 us (*) |  919 ns (-91%)
100 x 10**3 bytes |  930 us (*) | 55.2 us (-94%)
100 x 10**2 bytes | 93.1 us (*) | 5.84 us (-94%)
100 x 10**4 bytes | 9.85 ms (*) |  552 us (-94%)
------------------+-------------+---------------
Total             | 10.9 ms (*) |  614 us (-94%)
------------------+-------------+---------------

------------------+-------------+---------------
surrogatepass     |      before |          after
------------------+-------------+---------------
100 x 10**1 bytes | 4.83 us (*) |  963 ns (-80%)
100 x 10**3 bytes |  353 us (*) | 42.6 us (-88%)
100 x 10**2 bytes | 36.5 us (*) | 4.69 us (-87%)
100 x 10**4 bytes | 4.17 ms (*) |  424 us (-90%)
------------------+-------------+---------------
Total             | 4.56 ms (*) |  472 us (-90%)
------------------+-------------+---------------

------------------+-------------+--------------
backslashreplace  |      before |         after
------------------+-------------+--------------
100 x 10**1 bytes | 10.9 us (*) | 10.1 us (-7%)
100 x 10**3 bytes |  944 us (*) | 853 us (-10%)
100 x 10**2 bytes | 93.8 us (*) | 87.5 us (-7%)
100 x 10**4 bytes | 9.92 ms (*) | 9.04 ms (-9%)
------------------+-------------+--------------
Total             |   11 ms (*) | 9.99 ms (-9%)
------------------+-------------+--------------

-----------------+-------------+---------------
Summary          |      before |          after
-----------------+-------------+---------------
ignore           |    9 ms (*) |  507 us (-94%)
replace          | 10.6 ms (*) |  597 us (-94%)
surrogateescape  | 10.9 ms (*) |  614 us (-94%)
surrogatepass    | 4.56 ms (*) |  472 us (-90%)
backslashreplace |   11 ms (*) |  9.99 ms (-9%)
-----------------+-------------+---------------
Total            |   46 ms (*) | 12.2 ms (-73%)
-----------------+-------------+---------------
History
Date User Action Args
2015-09-22 09:37:01vstinnersetrecipients: + vstinner, ezio.melotti, r.david.murray, methane, python-dev, serhiy.storchaka
2015-09-22 09:37:01vstinnersetmessageid: <1442914621.21.0.895939680938.issue24870@psf.upfronthosting.co.za>
2015-09-22 09:37:01vstinnerlinkissue24870 messages
2015-09-22 09:36:59vstinnercreate