Message251270
I pushed a change to optimize the ASCII decoder.
Attached bench.py script: microbenchmark on the ASCII decoder. My results follows.
Common platform:
Platform: Linux-4.1.5-200.fc22.x86_64-x86_64-with-fedora-22-Twenty_Two
Bits: int=32, long=64, long long=64, size_t=64, void*=64
Timer: time.perf_counter
CFLAGS: -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
CPU model: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
Python unicode implementation: PEP 393
Timer info: namespace(adjustable=False, implementation='clock_gettime(CLOCK_MONOTONIC)', monotonic=True, resolution=1e-09)
Platform of campaign before:
Timer precision: 57 ns
Date: 2015-09-21 23:48:00
SCM: hg revision=73867bf953e6 branch=default date="2015-09-21 22:40 +0200"
Python version: 3.6.0a0 (default:73867bf953e6, Sep 21 2015, 23:47:35) [GCC 5.1.1 20150618 (Red Hat 5.1.1-4)]
Platform of campaign after:
Timer precision: 55 ns
Date: 2015-09-21 23:52:55
Python version: 3.6.0a0 (default:bb0f55f1ec22+, Sep 21 2015, 23:52:43) [GCC 5.1.1 20150618 (Red Hat 5.1.1-4)]
SCM: hg revision=bb0f55f1ec22+ tag=tip branch=default date="2015-09-21 23:06 +0200"
------------------+-------------+---------------
ignore | before | after
------------------+-------------+---------------
256 x 10**1 bytes | 314 us (*) | 5.25 us (-98%)
256 x 10**3 bytes | 31.9 ms (*) | 509 us (-98%)
256 x 10**2 bytes | 3.13 ms (*) | 50.2 us (-98%)
256 x 10**4 bytes | 315 ms (*) | 5.12 ms (-98%)
------------------+-------------+---------------
Total | 351 ms (*) | 5.69 ms (-98%)
------------------+-------------+---------------
------------------+-------------+---------------
replace | before | after
------------------+-------------+---------------
256 x 10**1 bytes | 352 us (*) | 6.32 us (-98%)
256 x 10**3 bytes | 35.2 ms (*) | 608 us (-98%)
256 x 10**2 bytes | 3.52 ms (*) | 60.9 us (-98%)
256 x 10**4 bytes | 354 ms (*) | 6.19 ms (-98%)
------------------+-------------+---------------
Total | 393 ms (*) | 6.87 ms (-98%)
------------------+-------------+---------------
------------------+-------------+---------------
surrogateescape | before | after
------------------+-------------+---------------
256 x 10**1 bytes | 369 us (*) | 5.92 us (-98%)
256 x 10**3 bytes | 36.8 ms (*) | 570 us (-98%)
256 x 10**2 bytes | 3.69 ms (*) | 56.9 us (-98%)
256 x 10**4 bytes | 371 ms (*) | 5.79 ms (-98%)
------------------+-------------+---------------
Total | 412 ms (*) | 6.43 ms (-98%)
------------------+-------------+---------------
------------------+-------------+--------
backslashreplace | before | after
------------------+-------------+--------
256 x 10**1 bytes | 357 us (*) | 361 us
256 x 10**3 bytes | 35.1 ms (*) | 36.1 ms
256 x 10**2 bytes | 3.52 ms (*) | 3.59 ms
256 x 10**4 bytes | 357 ms (*) | 365 ms
------------------+-------------+--------
Total | 396 ms (*) | 405 ms
------------------+-------------+--------
-----------------+--------------+---------------
Summary | before | after
-----------------+--------------+---------------
ignore | 351 ms (*) | 5.69 ms (-98%)
replace | 393 ms (*) | 6.87 ms (-98%)
surrogateescape | 412 ms (*) | 6.43 ms (-98%)
backslashreplace | 396 ms (*) | 405 ms
-----------------+--------------+---------------
Total | 1.55 sec (*) | 424 ms (-73%)
-----------------+--------------+--------------- |
|
Date |
User |
Action |
Args |
2015-09-21 22:13:03 | vstinner | set | recipients:
+ vstinner, ezio.melotti, r.david.murray, methane, python-dev, serhiy.storchaka |
2015-09-21 22:13:03 | vstinner | set | messageid: <1442873583.23.0.419362021884.issue24870@psf.upfronthosting.co.za> |
2015-09-21 22:13:03 | vstinner | link | issue24870 messages |
2015-09-21 22:13:01 | vstinner | create | |
|