STINNER Victor added the comment:

Some microbenchmarks: bench_fast.py.

== Python 3.6 / Python 3.6 FASTCALL ==

----------------------------------+--------------+---------------
Tests                             | /tmp/default |  /tmp/fastcall
----------------------------------+--------------+---------------
filter                            |   241 us (*) |  166 us (-31%)
map                               |   205 us (*) |  168 us (-18%)
sorted(list, key=lambda x: x)     |   242 us (*) |  162 us (-33%)
sorted(list)                      |  27.7 us (*) |        27.8 us
b=MyBytes(); bytes(b)             |   549 ns (*) |         533 ns
namedtuple.attr                   |  2.03 us (*) | 1.56 us (-23%)
object.__setattr__(obj, "x", 1)   |   347 ns (*) |  218 ns (-37%)
object.__getattribute__(obj, "x") |   331 ns (*) |  200 ns (-40%)
getattr(1, "real")                |   267 ns (*) |  150 ns (-44%)
bounded_pymethod(1, 2)            |   193 ns (*) |         190 ns
unbound_pymethod(obj, 1, 2        |   195 ns (*) |         192 ns
----------------------------------+--------------+---------------
Total                             |   719 us (*) |  526 us (-27%)
----------------------------------+--------------+---------------


== Compare Python 3.4 / Python 3.6 / Python 3.6 FASTCALL ==

Common platform:
Timer: time.perf_counter
Python unicode implementation: PEP 393
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
Platform: Linux-4.4.4-301.fc23.x86_64-x86_64-with-fedora-23-Twenty_Three
SCM: hg revision=abort: repository . not found! tag=abort: repository . not 
found! branch=abort: repository . not found! date=abort: no repository found in 
'/home/haypo/prog/python' (.hg not found)!
Bits: int=32, long=64, long long=64, size_t=64, void*=64

Platform of campaign /tmp/py34:
Python version: 3.4.3 (default, Jun 29 2015, 12:16:01) [GCC 5.1.1 20150618 (Red 
Hat 5.1.1-4)]
CFLAGS: -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g 
-pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic 
-D_GNU_SOURCE -fPIC -fwrapv
Timer precision: 78 ns
Date: 2016-04-22 13:37:52

Platform of campaign /tmp/default:
Python version: 3.6.0a0 (default:496e094f4734, Apr 22 2016, 02:18:13) [GCC 
5.3.1 20151207 (Red Hat 5.3.1-2)]
CFLAGS: -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes
Timer precision: 103 ns
Date: 2016-04-22 13:38:07

Platform of campaign /tmp/fastcall:
Python version: 3.6.0a0 (default:ad4a53ed1fbf, Apr 22 2016, 12:42:15) [GCC 
5.3.1 20151207 (Red Hat 5.3.1-2)]
Timer precision: 99 ns
CFLAGS: -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes
Date: 2016-04-22 13:38:21

----------------------------------+-------------+----------------+---------------
Tests                             |   /tmp/py34 |   /tmp/default |  
/tmp/fastcall
----------------------------------+-------------+----------------+---------------
filter                            |  325 us (*) |  241 us (-26%) |  166 us 
(-49%)
map                               |  260 us (*) |  205 us (-21%) |  168 us 
(-35%)
sorted(list, key=lambda x: x)     |  354 us (*) |  242 us (-32%) |  162 us 
(-54%)
sorted(list)                      | 46.9 us (*) | 27.7 us (-41%) | 27.8 us 
(-41%)
b=MyBytes(); bytes(b)             |  839 ns (*) |  549 ns (-35%) |  533 ns 
(-36%)
namedtuple.attr                   | 4.51 us (*) | 2.03 us (-55%) | 1.56 us 
(-65%)
object.__setattr__(obj, "x", 1)   |  447 ns (*) |  347 ns (-22%) |  218 ns 
(-51%)
object.__getattribute__(obj, "x") |  401 ns (*) |  331 ns (-17%) |  200 ns 
(-50%)
getattr(1, "real")                |  236 ns (*) |  267 ns (+13%) |  150 ns 
(-36%)
bounded_pymethod(1, 2)            |  249 ns (*) |  193 ns (-22%) |  190 ns 
(-24%)
unbound_pymethod(obj, 1, 2        |  251 ns (*) |  195 ns (-22%) |  192 ns 
(-23%)
----------------------------------+-------------+----------------+---------------
Total                             |  993 us (*) |  719 us (-28%) |  526 us 
(-47%)
----------------------------------+-------------+----------------+---------------

----------
Added file: http://bugs.python.org/file42567/bench_fast.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26814>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to