Construct BuiltinSumWithGenerator
Performance Diagrams
Source Code with Construct
return y for x in itertools.repeat(None, 500): calledRepeatedly((x for x in range(1000)), empty) print("OK.") # Python test originally created or extracted from other peoples work. The # parts from me are licensed as below. It is at least Free Software where # it's copied from other people. In these cases, that will normally be # indicated. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.
Source Code without Construct
return y for x in itertools.repeat(None, 500): calledRepeatedly((x for x in range(1000)), empty) print("OK.") # Python test originally created or extracted from other peoples work. The # parts from me are licensed as below. It is at least Free Software where # it's copied from other people. In these cases, that will normally be # indicated. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.
Context Diff of Source Code
Construct | Baseline | ||||
---|---|---|---|---|---|
11 | itertools | 11 | itertools | ||
12 | 12 | ||||
13 | # We measure making a generator iterator step or not. | 13 | # We measure making a generator iterator step or not. | ||
14 | 14 | ||||
15 | # construct_begin | 15 | # construct_begin | ||
n | 16 | y = sum(iterable) | n | 16 | |
17 | # construct_alternative | 17 | # construct_alternative | ||
t | 18 | t | 18 | y = sum(empty) | |
19 | 19 | # construct_end | |||
20 | 20 | ||||
21 | return y | 21 | return y | ||
22 | 22 | ||||
23 | 23 | ||||
24 | for x in itertools.repeat(None, 500): | 24 | for x in itertools.repeat(None, 500): |
Context Diff of Generated Code
Construct | Baseline | ||||
---|---|---|---|---|---|
173 | } | 173 | } | ||
174 | } | 174 | } | ||
175 | { | 175 | { | ||
176 | PyObject *tmp_assign_source_1; | 176 | PyObject *tmp_assign_source_1; | ||
177 | PyObject *tmp_sum_sequence_1; | 177 | PyObject *tmp_sum_sequence_1; | ||
n | 178 | CHECK_OBJECT(par_iterable); | n | 178 | CHECK_OBJECT(par_empty); |
179 | tmp_sum_sequence_1 = par_iterable; | 179 | tmp_sum_sequence_1 = par_empty; | ||
180 | tmp_assign_source_1 = BUILTIN_SUM1(tstate, tmp_sum_sequence_1); | 180 | tmp_assign_source_1 = BUILTIN_SUM1(tstate, tmp_sum_sequence_1); | ||
181 | if (tmp_assign_source_1 == NULL) { | 181 | if (tmp_assign_source_1 == NULL) { | ||
182 | assert(HAS_ERROR_OCCURRED(tstate)); | 182 | assert(HAS_ERROR_OCCURRED(tstate)); | ||
183 | 183 | ||||
184 | FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); | 184 | FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); | ||
185 | 185 | ||||
186 | 186 | ||||
t | 187 | exception_lineno = 16; | t | 187 | exception_lineno = 18; |
188 | type_description_1 = "ooo"; | 188 | type_description_1 = "ooo"; | ||
189 | goto frame_exception_exit_1; | 189 | goto frame_exception_exit_1; | ||
190 | } | 190 | } | ||
191 | assert(var_y == NULL); | 191 | assert(var_y == NULL); | ||
192 | var_y = tmp_assign_source_1; | 192 | var_y = tmp_assign_source_1; |