Construct CallCompiledFunctionPosArgsDefaults

Performance Diagrams

Construct CallCompiledFunctionPosArgsDefaults 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000150000000150000000CPython 3.10Nuitka (main)Nuitka (develop)Nuitka (factory)15732538988.11538461538461257.0CPython 3.1047999806240.03846153846155428.72074808183794Nuitka (main)48000072391.96153846153845428.72033026820515Nuitka (develop)48000273543.8846153846154428.72001455188865Nuitka (factory)Construct CallCompiledFunctionPosArgsDefaultsTicks Construct CallCompiledFunctionPosArgsDefaults 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)13744644788.11538461538461257.0CPython 3.844698707240.03846153846155423.7514435080864Nuitka (main)44699997391.96153846153845423.7491242131675Nuitka (develop)44699988543.8846153846154423.74914039429484Nuitka (factory)Construct CallCompiledFunctionPosArgsDefaultsTicks Construct CallCompiledFunctionPosArgsDefaults 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000150000000150000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)15733542288.11538461538461257.0CPython 2.743799974240.03846153846155435.321928675413Nuitka (main)43800000391.96153846153845435.32188783909066Nuitka (develop)43800000543.8846153846154435.32188783909066Nuitka (factory)Construct CallCompiledFunctionPosArgsDefaultsTicks

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;