[Python-Dev] Possible performance regression
Eric Snow
ericsnowcurrently at gmail.com
Mon Feb 25 01:06:08 EST 2019
On Sun, Feb 24, 2019 at 10:04 PM Eric Snow <ericsnowcurrently at gmail.com> wrote:
> I'll take a look tonight.
I made 2 successive runs of the script (on my laptop) for a commit
from early Saturday, and 2 runs from a commit this afternoon (close to
master). The output is below, with the earlier commit first. That
one is a little faster in places and a little slower in others.
However, I also saw quite a bit of variability in the results for the
same commit. So I'm not sure what to make of it.
I'll look into it in more depth tomorrow. FWIW, I have a few commits
in the range you described, so I want to make sure I didn't slow
things down for us. :)
-eric
* commit 175421b58cc97a2555e474f479f30a6c5d2250b0 (HEAD)
| Author: Pablo Galindo <Pablogsal at gmail.com>
| Date: Sat Feb 23 03:02:06 2019 +0000
|
| bpo-36016: Add generation option to gc.getobjects() (GH-11909)
$ ./python Tools/scripts/var_access_benchmark.py
Variable and attribute read access:
18.1 ns read_local
19.4 ns read_nonlocal
48.3 ns read_global
52.4 ns read_builtin
55.7 ns read_classvar_from_class
56.1 ns read_classvar_from_instance
78.6 ns read_instancevar
67.6 ns read_instancevar_slots
65.9 ns read_namedtuple
106.1 ns read_boundmethod
Variable and attribute write access:
25.1 ns write_local
26.9 ns write_nonlocal
^[[A
78.0 ns write_global
154.1 ns write_classvar
132.0 ns write_instancevar
88.2 ns write_instancevar_slots
Data structure read access:
69.6 ns read_list
69.0 ns read_deque
68.4 ns read_dict
Data structure write access:
73.2 ns write_list
79.0 ns write_deque
103.5 ns write_dict
Stack (or queue) operations:
348.3 ns list_append_pop
169.0 ns deque_append_pop
170.8 ns deque_append_popleft
Timing loop overhead:
1.3 ns loop_overhead
$ ./python Tools/scripts/var_access_benchmark.py
Variable and attribute read access:
17.7 ns read_local
19.2 ns read_nonlocal
39.9 ns read_global
50.3 ns read_builtin
54.4 ns read_classvar_from_class
55.8 ns read_classvar_from_instance
80.3 ns read_instancevar
70.7 ns read_instancevar_slots
66.1 ns read_namedtuple
108.9 ns read_boundmethod
Variable and attribute write access:
25.1 ns write_local
25.6 ns write_nonlocal
70.0 ns write_global
151.5 ns write_classvar
133.9 ns write_instancevar
90.7 ns write_instancevar_slots
Data structure read access:
140.7 ns read_list
89.6 ns read_deque
86.6 ns read_dict
Data structure write access:
97.9 ns write_list
100.5 ns write_deque
120.0 ns write_dict
Stack (or queue) operations:
375.9 ns list_append_pop
179.3 ns deque_append_pop
179.4 ns deque_append_popleft
Timing loop overhead:
1.5 ns loop_overhead
* commit 3b0abb019662e42070f1d6f7e74440afb1808f03 (HEAD)
| Author: Giampaolo Rodola <g.rodola at gmail.com>
| Date: Sun Feb 24 15:46:40 2019 -0800
|
| bpo-33671: allow setting shutil.copyfile() bufsize globally (GH-12016)
$ ./python Tools/scripts/var_access_benchmark.py
Variable and attribute read access:
20.2 ns read_local
20.0 ns read_nonlocal
41.9 ns read_global
52.9 ns read_builtin
56.3 ns read_classvar_from_class
56.9 ns read_classvar_from_instance
80.2 ns read_instancevar
70.6 ns read_instancevar_slots
69.5 ns read_namedtuple
114.5 ns read_boundmethod
Variable and attribute write access:
23.4 ns write_local
25.0 ns write_nonlocal
74.5 ns write_global
152.0 ns write_classvar
131.7 ns write_instancevar
90.1 ns write_instancevar_slots
Data structure read access:
69.9 ns read_list
73.4 ns read_deque
77.8 ns read_dict
Data structure write access:
83.3 ns write_list
94.9 ns write_deque
120.6 ns write_dict
Stack (or queue) operations:
383.4 ns list_append_pop
187.1 ns deque_append_pop
182.2 ns deque_append_popleft
Timing loop overhead:
1.4 ns loop_overhead
$ ./python Tools/scripts/var_access_benchmark.py
Variable and attribute read access:
19.1 ns read_local
20.9 ns read_nonlocal
43.8 ns read_global
57.8 ns read_builtin
58.4 ns read_classvar_from_class
61.3 ns read_classvar_from_instance
84.7 ns read_instancevar
72.9 ns read_instancevar_slots
69.7 ns read_namedtuple
109.9 ns read_boundmethod
Variable and attribute write access:
23.1 ns write_local
23.7 ns write_nonlocal
72.8 ns write_global
149.9 ns write_classvar
133.3 ns write_instancevar
89.4 ns write_instancevar_slots
Data structure read access:
69.0 ns read_list
69.6 ns read_deque
69.1 ns read_dict
Data structure write access:
74.5 ns write_list
80.9 ns write_deque
105.4 ns write_dict
Stack (or queue) operations:
338.2 ns list_append_pop
165.6 ns deque_append_pop
164.7 ns deque_append_popleft
Timing loop overhead:
1.3 ns loop_overhead
More information about the Python-Dev
mailing list