Construct BuiltinSumWithList
Performance Diagrams
Source Code with Construct
empty = () value = list(range(10)) def calledRepeatedly(iterable, empty): # Force frame value # We measure making a list iterator step or not. # construct_begin y = sum(iterable) # construct_alternative return x, y import itertools for x in itertools.repeat(None, 50000): calledRepeatedly(value, empty) print("OK.")
Source Code without Construct
empty = () value = list(range(10)) def calledRepeatedly(iterable, empty): # Force frame value # We measure making a list iterator step or not. # construct_begin # construct_alternative y = sum(empty) # construct_end return x, y import itertools for x in itertools.repeat(None, 50000): calledRepeatedly(value, empty) print("OK.")
Context Diff of Source Code
Construct | Baseline | ||||
---|---|---|---|---|---|
27 | value | 27 | value | ||
28 | 28 | ||||
29 | # We measure making a list iterator step or not. | 29 | # We measure making a list iterator step or not. | ||
30 | 30 | ||||
31 | # construct_begin | 31 | # construct_begin | ||
n | 32 | y = sum(iterable) | n | 32 | |
33 | # construct_alternative | 33 | # construct_alternative | ||
t | 34 | t | 34 | y = sum(empty) | |
35 | 35 | # construct_end | |||
36 | 36 | ||||
37 | return x, y | 37 | return x, y | ||
38 | 38 | ||||
39 | import itertools | 39 | import itertools | ||
40 | for x in itertools.repeat(None, 50000): | 40 | for x in itertools.repeat(None, 50000): |
Context Diff of Generated Code
Construct | Baseline | ||||
---|---|---|---|---|---|
167 | } | 167 | } | ||
168 | } | 168 | } | ||
169 | { | 169 | { | ||
170 | PyObject *tmp_assign_source_1; | 170 | PyObject *tmp_assign_source_1; | ||
171 | PyObject *tmp_sum_sequence_1; | 171 | PyObject *tmp_sum_sequence_1; | ||
n | 172 | CHECK_OBJECT(par_iterable); | n | 172 | CHECK_OBJECT(par_empty); |
173 | tmp_sum_sequence_1 = par_iterable; | 173 | tmp_sum_sequence_1 = par_empty; | ||
174 | tmp_assign_source_1 = BUILTIN_SUM1(tmp_sum_sequence_1); | 174 | tmp_assign_source_1 = BUILTIN_SUM1(tmp_sum_sequence_1); | ||
175 | if (tmp_assign_source_1 == NULL) { | 175 | if (tmp_assign_source_1 == NULL) { | ||
176 | assert(ERROR_OCCURRED()); | 176 | assert(ERROR_OCCURRED()); | ||
177 | 177 | ||||
178 | FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); | 178 | FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); | ||
179 | 179 | ||||
180 | 180 | ||||
t | 181 | exception_lineno = 32; | t | 181 | exception_lineno = 34; |
182 | type_description_1 = "ooo"; | 182 | type_description_1 = "ooo"; | ||
183 | goto frame_exception_exit_1; | 183 | goto frame_exception_exit_1; | ||
184 | } | 184 | } | ||
185 | assert(var_y == NULL); | 185 | assert(var_y == NULL); | ||
186 | var_y = tmp_assign_source_1; | 186 | var_y = tmp_assign_source_1; |