STINNER Victor added the comment: Updated bench_fast-2.py result with Python compiled with PGO+LTO, with benchmark.py fixed to compute average + standard deviation. Only getattr() really seems slower:
----------------------------------+-----------------------+-------------------------- Tests | original | fastcall ----------------------------------+-----------------------+-------------------------- filter | 75.8 us +- 0.1 us (*) | 78.1 us +- 0.1 us map | 72.6 us +- 0.1 us (*) | 71.4 us +- 0.0 us sorted(list, key=lambda x: x) | 83.7 us +- 0.1 us (*) | 82.3 us +- 0.3 us sorted(list) | 14.9 us +- 0.0 us (*) | 14.7 us +- 0.0 us b=MyBytes(); bytes(b) | 199 ns +- 2 ns (*) | 194 ns +- 1 ns namedtuple.attr | 830 ns +- 20 ns (*) | 1.09 us +- 0.01 us (+31%) object.__setattr__(obj, "x", 1) | 133 ns +- 0 ns (*) | 134 ns +- 1 ns object.__getattribute__(obj, "x") | 117 ns +- 0 ns (*) | 115 ns +- 1 ns getattr(1, "real") | 93.2 ns +- 0.9 ns (*) | 76.9 ns +- 0.7 ns (-17%) bounded_pymethod(1, 2) | 73.4 ns +- 0.6 ns (*) | 70.7 ns +- 0.4 ns unbound_pymethod(obj, 1, 2) | 74.5 ns +- 0.2 ns (*) | 71.8 ns +- 0.6 ns func() | 60.2 ns +- 0.4 ns (*) | 59.3 ns +- 0.1 ns func(1, 2, 3) | 74.6 ns +- 0.4 ns (*) | 72.2 ns +- 0.3 ns ----------------------------------+-----------------------+-------------------------- Total | 249 us (*) | 248 us ----------------------------------+-----------------------+-------------------------- ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27128> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com