Construct GeneratorExpressionUsage
Performance Diagrams
Source Code with Construct
# make sure it is still running. y = next(gen) return x, y for x in itertools.repeat(None, 50000): calledRepeatedly() 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
# make sure it is still running. y = next(gen) return x, y for x in itertools.repeat(None, 50000): calledRepeatedly() 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 | ||||
---|---|---|---|---|---|
13 | # make sure it is started. | 13 | # make sure it is started. | ||
14 | x = next(gen) | 14 | x = next(gen) | ||
15 | 15 | ||||
16 | # This should abort. | 16 | # This should abort. | ||
17 | # construct_begin | 17 | # construct_begin | ||
t | 18 | all(gen) | t | 18 | |
19 | # construct_end | 19 | |||
20 | 20 | ||||
21 | # make sure it is still running. | 21 | # make sure it is still running. | ||
22 | y = next(gen) | 22 | y = next(gen) | ||
23 | 23 | ||||
24 | return x, y | 24 | return x, y |
Context Diff of Generated Code
Construct | Baseline | ||||
---|---|---|---|---|---|
115 | NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; | 115 | NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; | ||
116 | PyObject *exception_type = NULL; | 116 | PyObject *exception_type = NULL; | ||
117 | PyObject *exception_value = NULL; | 117 | PyObject *exception_value = NULL; | ||
118 | PyTracebackObject *exception_tb = NULL; | 118 | PyTracebackObject *exception_tb = NULL; | ||
119 | NUITKA_MAY_BE_UNUSED int exception_lineno = 0; | 119 | NUITKA_MAY_BE_UNUSED int exception_lineno = 0; | ||
n | 120 | NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; | n | ||
121 | static struct Nuitka_FrameObject *cache_frame_5ccc98682733f584392bf5df4d049c6a = NULL; | 120 | static struct Nuitka_FrameObject *cache_frame_5ccc98682733f584392bf5df4d049c6a = NULL; | ||
122 | PyObject *tmp_return_value = NULL; | 121 | PyObject *tmp_return_value = NULL; | ||
123 | PyObject *exception_keeper_type_1; | 122 | PyObject *exception_keeper_type_1; | ||
124 | PyObject *exception_keeper_value_1; | 123 | PyObject *exception_keeper_value_1; | ||
125 | PyTracebackObject *exception_keeper_tb_1; | 124 | PyTracebackObject *exception_keeper_tb_1; | ||
235 | exception_lineno = 14; | 234 | exception_lineno = 14; | ||
236 | goto frame_exception_exit_1; | 235 | goto frame_exception_exit_1; | ||
237 | } | 236 | } | ||
238 | assert(var_x == NULL); | 237 | assert(var_x == NULL); | ||
239 | var_x = tmp_assign_source_3; | 238 | var_x = tmp_assign_source_3; | ||
t | 240 | } | t | ||
241 | { | ||||
242 | PyObject *tmp_all_arg_1; | ||||
243 | PyObject *tmp_capi_result_1; | ||||
244 | CHECK_OBJECT(var_gen); | ||||
245 | tmp_all_arg_1 = var_gen; | ||||
246 | tmp_capi_result_1 = BUILTIN_ALL(tstate, tmp_all_arg_1); | ||||
247 | if (tmp_capi_result_1 == NULL) { | ||||
248 | assert(HAS_ERROR_OCCURRED(tstate)); | ||||
249 | |||||
250 | FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); | ||||
251 | |||||
252 | |||||
253 | exception_lineno = 18; | ||||
254 | type_description_1 = "ooo"; | ||||
255 | goto frame_exception_exit_1; | ||||
256 | } | ||||
257 | Py_DECREF(tmp_capi_result_1); | ||||
258 | } | 239 | } | ||
259 | { | 240 | { | ||
260 | PyObject *tmp_assign_source_4; | 241 | PyObject *tmp_assign_source_4; | ||
261 | PyObject *tmp_value_value_2; | 242 | PyObject *tmp_value_value_2; | ||
262 | CHECK_OBJECT(var_gen); | 243 | CHECK_OBJECT(var_gen); |