Raymond Hettinger <[email protected]> added the comment:
> can you include your python 2.7 runs? for me it looks similar
It will give similar results unless you switch to old-style classes (edit out
the inheritance from object).
class A:
pass
A.x = 1
---------------------------------------
$ python2.7 var_access_benchmark.py
Variable and attribute read access:
6.7 ns read_local
10.9 ns read_global
18.9 ns read_builtin
24.4 ns read_classvar_from_class
30.2 ns read_classvar_from_instance
22.7 ns read_instancevar
25.5 ns read_instancevar_slots
99.3 ns read_namedtuple
40.9 ns read_boundmethod
Variable and attribute write access:
8.2 ns write_local
18.7 ns write_global
32.9 ns write_classvar <== Not formerly an outlier
32.5 ns write_instancevar
31.2 ns write_instancevar_slots
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36012>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com