Construct CallCompiledFunctionPosArgsDefaults
Performance Diagrams
Source Code with Construct
compiled_f() compiled_f() # construct_alternative return compiled_f 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
# construct_alternative pass # construct_end return compiled_f 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 | ||||
---|---|---|---|---|---|
14 | # This is supposed to make a call to a compiled function, which is | 14 | # This is supposed to make a call to a compiled function, which is | ||
15 | # being optimized separately. | 15 | # being optimized separately. | ||
16 | compiled_f = compiled_func | 16 | compiled_f = compiled_func | ||
17 | 17 | ||||
18 | # construct_begin | 18 | # construct_begin | ||
n | 19 | compiled_f() | n | ||
20 | compiled_f() | ||||
21 | compiled_f() | ||||
22 | # construct_alternative | ||||
23 | 19 | ||||
24 | 20 | ||||
t | t | 21 | |||
22 | # construct_alternative | ||||
23 | pass | ||||
24 | # construct_end | ||||
25 | 25 | ||||
26 | return compiled_f | 26 | return compiled_f | ||
27 | 27 | ||||
28 | 28 | ||||
29 | for x in itertools.repeat(None, 50000): | 29 | for x in itertools.repeat(None, 50000): |
Context Diff of Generated Code
Construct | Baseline | ||||
---|---|---|---|---|---|
179 | NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; | 179 | NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; | ||
180 | PyObject *exception_type = NULL; | 180 | PyObject *exception_type = NULL; | ||
181 | PyObject *exception_value = NULL; | 181 | PyObject *exception_value = NULL; | ||
182 | PyTracebackObject *exception_tb = NULL; | 182 | PyTracebackObject *exception_tb = NULL; | ||
183 | NUITKA_MAY_BE_UNUSED int exception_lineno = 0; | 183 | NUITKA_MAY_BE_UNUSED int exception_lineno = 0; | ||
n | 184 | NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; | n | ||
185 | static struct Nuitka_FrameObject *cache_frame_243c376307ebf2ec020a4816b6c66c0e = NULL; | 184 | static struct Nuitka_FrameObject *cache_frame_243c376307ebf2ec020a4816b6c66c0e = NULL; | ||
186 | PyObject *tmp_return_value = NULL; | 185 | PyObject *tmp_return_value = NULL; | ||
187 | PyObject *exception_keeper_type_1; | 186 | PyObject *exception_keeper_type_1; | ||
188 | PyObject *exception_keeper_value_1; | 187 | PyObject *exception_keeper_value_1; | ||
189 | PyTracebackObject *exception_keeper_tb_1; | 188 | PyTracebackObject *exception_keeper_tb_1; | ||
237 | goto frame_exception_exit_1; | 236 | goto frame_exception_exit_1; | ||
238 | } | 237 | } | ||
239 | assert(var_compiled_f == NULL); | 238 | assert(var_compiled_f == NULL); | ||
240 | Py_INCREF(tmp_assign_source_1); | 239 | Py_INCREF(tmp_assign_source_1); | ||
241 | var_compiled_f = tmp_assign_source_1; | 240 | var_compiled_f = tmp_assign_source_1; | ||
n | 242 | } | n | ||
243 | { | ||||
244 | PyObject *tmp_called_value_1; | ||||
245 | PyObject *tmp_call_result_1; | ||||
246 | CHECK_OBJECT(var_compiled_f); | ||||
247 | tmp_called_value_1 = var_compiled_f; | ||||
248 | frame_243c376307ebf2ec020a4816b6c66c0e->m_frame.f_lineno = 19; | ||||
249 | tmp_call_result_1 = CALL_FUNCTION_NO_ARGS(tstate, tmp_called_value_1); | ||||
250 | if (tmp_call_result_1 == NULL) { | ||||
251 | assert(HAS_ERROR_OCCURRED(tstate)); | ||||
252 | |||||
253 | FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); | ||||
254 | |||||
255 | |||||
256 | exception_lineno = 19; | ||||
257 | type_description_1 = "o"; | ||||
258 | goto frame_exception_exit_1; | ||||
259 | } | ||||
260 | Py_DECREF(tmp_call_result_1); | ||||
261 | } | ||||
262 | { | ||||
263 | PyObject *tmp_called_value_2; | ||||
264 | PyObject *tmp_call_result_2; | ||||
265 | CHECK_OBJECT(var_compiled_f); | ||||
266 | tmp_called_value_2 = var_compiled_f; | ||||
267 | frame_243c376307ebf2ec020a4816b6c66c0e->m_frame.f_lineno = 20; | ||||
268 | tmp_call_result_2 = CALL_FUNCTION_NO_ARGS(tstate, tmp_called_value_2); | ||||
269 | if (tmp_call_result_2 == NULL) { | ||||
270 | assert(HAS_ERROR_OCCURRED(tstate)); | ||||
271 | |||||
272 | FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); | ||||
273 | |||||
274 | |||||
275 | exception_lineno = 20; | ||||
276 | type_description_1 = "o"; | ||||
277 | goto frame_exception_exit_1; | ||||
278 | } | ||||
279 | Py_DECREF(tmp_call_result_2); | ||||
280 | } | ||||
281 | { | ||||
282 | PyObject *tmp_called_value_3; | ||||
283 | PyObject *tmp_call_result_3; | ||||
284 | CHECK_OBJECT(var_compiled_f); | ||||
285 | tmp_called_value_3 = var_compiled_f; | ||||
286 | frame_243c376307ebf2ec020a4816b6c66c0e->m_frame.f_lineno = 21; | ||||
287 | tmp_call_result_3 = CALL_FUNCTION_NO_ARGS(tstate, tmp_called_value_3); | ||||
288 | if (tmp_call_result_3 == NULL) { | ||||
289 | assert(HAS_ERROR_OCCURRED(tstate)); | ||||
290 | |||||
291 | FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); | ||||
292 | |||||
293 | |||||
294 | exception_lineno = 21; | ||||
295 | type_description_1 = "o"; | ||||
296 | goto frame_exception_exit_1; | ||||
297 | } | ||||
298 | Py_DECREF(tmp_call_result_3); | ||||
299 | } | 241 | } | ||
300 | 242 | ||||
301 | 243 | ||||
302 | // Put the previous frame back on top. | 244 | // Put the previous frame back on top. | ||
303 | popFrameStack(tstate); | 245 | popFrameStack(tstate); | ||
359 | exception_type = NULL; | 301 | exception_type = NULL; | ||
360 | exception_value = NULL; | 302 | exception_value = NULL; | ||
361 | exception_tb = NULL; | 303 | exception_tb = NULL; | ||
362 | exception_lineno = 0; | 304 | exception_lineno = 0; | ||
363 | 305 | ||||
t | 364 | Py_XDECREF(var_compiled_f); | t | ||
365 | var_compiled_f = NULL; | ||||
366 | // Re-raise. | 306 | // Re-raise. | ||
367 | exception_type = exception_keeper_type_1; | 307 | exception_type = exception_keeper_type_1; | ||
368 | exception_value = exception_keeper_value_1; | 308 | exception_value = exception_keeper_value_1; | ||
369 | exception_tb = exception_keeper_tb_1; | 309 | exception_tb = exception_keeper_tb_1; | ||
370 | exception_lineno = exception_keeper_lineno_1; | 310 | exception_lineno = exception_keeper_lineno_1; |