Construct CallCompiledObjectMethodNoArgs

Performance Diagrams

Construct CallCompiledObjectMethodNoArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000CPython 3.10Nuitka (main)Nuitka (develop)Nuitka (factory)10298822088.11538461538461257.0CPython 3.1031900302240.03846153846155427.5721120151113Nuitka (main)31900056391.96153846153845427.57270228052823Nuitka (develop)31900269543.8846153846154427.57219119705746Nuitka (factory)Construct CallCompiledObjectMethodNoArgsTicks Construct CallCompiledObjectMethodNoArgs 0010000000100000002000000020000000300000003000000040000000400000005000000050000000600000006000000070000000700000008000000080000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)8826305588.95192307692307257.0CPython 3.830700271242.31730769230768418.1619890982961Nuitka (main)30699865395.6826923076923418.1631258009193Nuitka (develop)30699930549.0480769230769418.1629438165092Nuitka (factory)Construct CallCompiledObjectMethodNoArgsTicks Construct CallCompiledObjectMethodNoArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)11475157988.11538461538461257.0CPython 2.730949890240.03846153846155437.4653738895728Nuitka (main)30948956391.96153846153845437.46738524114846Nuitka (develop)30948956543.8846153846154437.46738524114846Nuitka (factory)Construct CallCompiledObjectMethodNoArgsTicks

Source Code with Construct

    inst.compiled_method()
    inst.compiled_method()
    inst.compiled_method()

    # construct_alternative




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


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
15     inst = C() 15     inst = C()
16 16
17     # This is supposed to make a call to a compiled method, which is 17     # This is supposed to make a call to a compiled method, which is
18     # being optimized separately. 18     # being optimized separately.
19     # construct_begin 19     # construct_begin
n 20     inst.compiled_method() n 20  
21     inst.compiled_method() 21  
22     inst.compiled_method() 22  
23 23
24     # construct_alternative 24     # construct_alternative
t 25   t 25     pass
26   26     # construct_end
27 27
28 28
29 for x in itertools.repeat(None, 50000): 29 for x in itertools.repeat(None, 50000):
30     calledRepeatedly() 30     calledRepeatedly()
31 31

Context Diff of Generated Code


Construct
Baseline
83 static PyCodeObject *codeobj_da65478ef0f9340fc6fdcaf9f76ce7d5; 83 static PyCodeObject *codeobj_da65478ef0f9340fc6fdcaf9f76ce7d5;
84 /* For use in "MainProgram.c". */ 84 /* For use in "MainProgram.c". */
85 PyCodeObject *codeobj_main = NULL; 85 PyCodeObject *codeobj_main = NULL;
86 86
87 static void createModuleCodeObjects(void) { 87 static void createModuleCodeObjects(void) {
n 88     module_filename_obj = mod_consts[3]; CHECK_OBJECT(module_filename_obj); n 88     module_filename_obj = mod_consts[2]; CHECK_OBJECT(module_filename_obj);
89     codeobj_11773f039aa8a272c59029808ed3a889 = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[17], mod_consts[17], NULL, NULL, 0, 0, 0); 89     codeobj_11773f039aa8a272c59029808ed3a889 = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[17], mod_consts[17], NULL, NULL, 0, 0, 0);
90     codeobj_main = codeobj_11773f039aa8a272c59029808ed3a889; 90     codeobj_main = codeobj_11773f039aa8a272c59029808ed3a889;
91     codeobj_ead662ef396b5b1cf6e5e35fc9e51928 = MAKE_CODE_OBJECT(module_filename_obj, 14, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[11], mod_consts[11], mod_consts[18], NULL, 0, 0, 0); 91     codeobj_ead662ef396b5b1cf6e5e35fc9e51928 = MAKE_CODE_OBJECT(module_filename_obj, 14, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[11], mod_consts[11], mod_consts[18], NULL, 0, 0, 0);
n 92     codeobj_da65478ef0f9340fc6fdcaf9f76ce7d5 = MAKE_CODE_OBJECT(module_filename_obj, 10, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[1], mod_consts[19], mod_consts[20], NULL, 1, 0, 0); n 92     codeobj_da65478ef0f9340fc6fdcaf9f76ce7d5 = MAKE_CODE_OBJECT(module_filename_obj, 10, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[6], mod_consts[19], mod_consts[20], NULL, 1, 0, 0);
93 } 93 }
94 94
95 // The module function declarations. 95 // The module function declarations.
96 static PyObject *MAKE_FUNCTION___main__$$$function__1_compiled_method(); 96 static PyObject *MAKE_FUNCTION___main__$$$function__1_compiled_method();
97 97
145     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 145     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
146     PyObject *exception_type = NULL; 146     PyObject *exception_type = NULL;
147     PyObject *exception_value = NULL; 147     PyObject *exception_value = NULL;
148     PyTracebackObject *exception_tb = NULL; 148     PyTracebackObject *exception_tb = NULL;
149     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 149     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 150     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; n
151     static struct Nuitka_FrameObject *cache_frame_ead662ef396b5b1cf6e5e35fc9e51928 = NULL; 150     static struct Nuitka_FrameObject *cache_frame_ead662ef396b5b1cf6e5e35fc9e51928 = NULL;
152     PyObject *tmp_return_value = NULL; 151     PyObject *tmp_return_value = NULL;
153     PyObject *exception_keeper_type_1; 152     PyObject *exception_keeper_type_1;
154     PyObject *exception_keeper_value_1; 153     PyObject *exception_keeper_value_1;
155     PyTracebackObject *exception_keeper_tb_1; 154     PyTracebackObject *exception_keeper_tb_1;
215             type_description_1 = "o"; 214             type_description_1 = "o";
216             goto frame_exception_exit_1; 215             goto frame_exception_exit_1;
217         } 216         }
218         assert(var_inst == NULL); 217         assert(var_inst == NULL);
219         var_inst = tmp_assign_source_1; 218         var_inst = tmp_assign_source_1;
n 220     } n
221     {
222         PyObject *tmp_called_instance_1;
223         PyObject *tmp_call_result_1;
224         CHECK_OBJECT(var_inst);
225         tmp_called_instance_1 = var_inst;
226         frame_ead662ef396b5b1cf6e5e35fc9e51928->m_frame.f_lineno = 20;
227         tmp_call_result_1 = CALL_METHOD_NO_ARGS(tstate, tmp_called_instance_1, mod_consts[1]);
228         if (tmp_call_result_1 == NULL) {
229             assert(HAS_ERROR_OCCURRED(tstate));
230  
231             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
232  
233  
234             exception_lineno = 20;
235             type_description_1 = "o";
236             goto frame_exception_exit_1;
237         }
238         Py_DECREF(tmp_call_result_1);
239     }
240     {
241         PyObject *tmp_called_instance_2;
242         PyObject *tmp_call_result_2;
243         CHECK_OBJECT(var_inst);
244         tmp_called_instance_2 = var_inst;
245         frame_ead662ef396b5b1cf6e5e35fc9e51928->m_frame.f_lineno = 21;
246         tmp_call_result_2 = CALL_METHOD_NO_ARGS(tstate, tmp_called_instance_2, mod_consts[1]);
247         if (tmp_call_result_2 == NULL) {
248             assert(HAS_ERROR_OCCURRED(tstate));
249  
250             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
251  
252  
253             exception_lineno = 21;
254             type_description_1 = "o";
255             goto frame_exception_exit_1;
256         }
257         Py_DECREF(tmp_call_result_2);
258     }
259     {
260         PyObject *tmp_called_instance_3;
261         PyObject *tmp_call_result_3;
262         CHECK_OBJECT(var_inst);
263         tmp_called_instance_3 = var_inst;
264         frame_ead662ef396b5b1cf6e5e35fc9e51928->m_frame.f_lineno = 22;
265         tmp_call_result_3 = CALL_METHOD_NO_ARGS(tstate, tmp_called_instance_3, mod_consts[1]);
266         if (tmp_call_result_3 == NULL) {
267             assert(HAS_ERROR_OCCURRED(tstate));
268  
269             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
270  
271  
272             exception_lineno = 22;
273             type_description_1 = "o";
274             goto frame_exception_exit_1;
275         }
276         Py_DECREF(tmp_call_result_3);
277     } 219     }
278 220
279 221
280     // Put the previous frame back on top. 222     // Put the previous frame back on top.
281     popFrameStack(tstate); 223     popFrameStack(tstate);
336     exception_type = NULL; 278     exception_type = NULL;
337     exception_value = NULL; 279     exception_value = NULL;
338     exception_tb = NULL; 280     exception_tb = NULL;
339     exception_lineno = 0; 281     exception_lineno = 0;
340 282
n 341     Py_XDECREF(var_inst); n
342     var_inst = NULL;
343     // Re-raise. 283     // Re-raise.
344     exception_type = exception_keeper_type_1; 284     exception_type = exception_keeper_type_1;
345     exception_value = exception_keeper_value_1; 285     exception_value = exception_keeper_value_1;
346     exception_tb = exception_keeper_tb_1; 286     exception_tb = exception_keeper_tb_1;
347     exception_lineno = exception_keeper_lineno_1; 287     exception_lineno = exception_keeper_lineno_1;
373 313
374 314
375 static PyObject *MAKE_FUNCTION___main__$$$function__1_compiled_method() { 315 static PyObject *MAKE_FUNCTION___main__$$$function__1_compiled_method() {
376     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 316     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
377         impl___main__$$$function__1_compiled_method, 317         impl___main__$$$function__1_compiled_method,
n 378         mod_consts[1], n 318         mod_consts[6],
379 #if PYTHON_VERSION >= 0x300 319 #if PYTHON_VERSION >= 0x300
380         NULL, 320         NULL,
381 #endif 321 #endif
382         codeobj_da65478ef0f9340fc6fdcaf9f76ce7d5, 322         codeobj_da65478ef0f9340fc6fdcaf9f76ce7d5,
383         NULL, 323         NULL,
788 728
789     // Module code. 729     // Module code.
790     { 730     {
791         PyObject *tmp_assign_source_1; 731         PyObject *tmp_assign_source_1;
792         tmp_assign_source_1 = Py_None; 732         tmp_assign_source_1 = Py_None;
n 793         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1); n 733         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_1);
794     } 734     }
795     { 735     {
796         PyObject *tmp_assign_source_2; 736         PyObject *tmp_assign_source_2;
n 797         tmp_assign_source_2 = mod_consts[3]; n 737         tmp_assign_source_2 = mod_consts[2];
798         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2); 738         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_2);
799     } 739     }
800     { 740     {
801         PyObject *tmp_assign_source_3; 741         PyObject *tmp_assign_source_3;
802         { 742         {
803             PyObject *hard_module = IMPORT_HARD___FUTURE__(); 743             PyObject *hard_module = IMPORT_HARD___FUTURE__();
n 804             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[5]); n 744             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[4]);
805         } 745         }
806         assert(!(tmp_assign_source_3 == NULL)); 746         assert(!(tmp_assign_source_3 == NULL));
n 807         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3); n 747         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_3);
808     } 748     }
809     frame_11773f039aa8a272c59029808ed3a889 = MAKE_MODULE_FRAME(codeobj_11773f039aa8a272c59029808ed3a889, module___main__); 749     frame_11773f039aa8a272c59029808ed3a889 = MAKE_MODULE_FRAME(codeobj_11773f039aa8a272c59029808ed3a889, module___main__);
810 750
811     // Push the new frame as the currently active one, and we should be exclusively 751     // Push the new frame as the currently active one, and we should be exclusively
812     // owning it. 752     // owning it.
818         PyObject *tmp_assign_source_4; 758         PyObject *tmp_assign_source_4;
819         PyObject *tmp_name_value_1; 759         PyObject *tmp_name_value_1;
820         PyObject *tmp_globals_arg_value_1; 760         PyObject *tmp_globals_arg_value_1;
821         PyObject *tmp_locals_arg_value_1; 761         PyObject *tmp_locals_arg_value_1;
822         PyObject *tmp_fromlist_value_1; 762         PyObject *tmp_fromlist_value_1;
n 823         tmp_name_value_1 = mod_consts[6]; n 763         tmp_name_value_1 = mod_consts[5];
824         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__; 764         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__;
825         tmp_locals_arg_value_1 = Py_None; 765         tmp_locals_arg_value_1 = Py_None;
826         tmp_fromlist_value_1 = Py_None; 766         tmp_fromlist_value_1 = Py_None;
827         frame_11773f039aa8a272c59029808ed3a889->m_frame.f_lineno = 6; 767         frame_11773f039aa8a272c59029808ed3a889->m_frame.f_lineno = 6;
828         tmp_assign_source_4 = IMPORT_MODULE4(tstate, tmp_name_value_1, tmp_globals_arg_value_1, tmp_locals_arg_value_1, tmp_fromlist_value_1); 768         tmp_assign_source_4 = IMPORT_MODULE4(tstate, tmp_name_value_1, tmp_globals_arg_value_1, tmp_locals_arg_value_1, tmp_fromlist_value_1);
834 774
835             exception_lineno = 6; 775             exception_lineno = 6;
836 776
837             goto frame_exception_exit_1; 777             goto frame_exception_exit_1;
838         } 778         }
n 839         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_4); n 779         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_4);
840     } 780     }
841     { 781     {
842         PyObject *tmp_assign_source_5; 782         PyObject *tmp_assign_source_5;
843         { 783         {
844             PyObject *tmp_assign_source_6; 784             PyObject *tmp_assign_source_6;
858             tmp_assign_source_5 = _PyDict_NewPresized( 2 ); 798             tmp_assign_source_5 = _PyDict_NewPresized( 2 );
859             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 799             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
860             assert(!(tmp_res != 0)); 800             assert(!(tmp_res != 0));
861             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method); 801             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method);
862             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method; 802             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method;
n 863             tmp_dict_key_1 = mod_consts[1]; n 803             tmp_dict_key_1 = mod_consts[6];
864             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 804             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
865             assert(!(tmp_res != 0)); 805             assert(!(tmp_res != 0));
866             goto try_return_handler_1; 806             goto try_return_handler_1;
867         } 807         }
868         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases"); 808         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases");
1000     } 940     }
1001     { 941     {
1002         PyObject *tmp_assign_source_11; 942         PyObject *tmp_assign_source_11;
1003         PyObject *tmp_iter_arg_1; 943         PyObject *tmp_iter_arg_1;
1004         PyObject *tmp_called_instance_1; 944         PyObject *tmp_called_instance_1;
n 1005         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[6]); n 945         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[5]);
1006 946
1007         if (unlikely(tmp_called_instance_1 == NULL)) { 947         if (unlikely(tmp_called_instance_1 == NULL)) {
t 1008             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[6]); t 948             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[5]);
1009         } 949         }
1010 950
1011         if (tmp_called_instance_1 == NULL) { 951         if (tmp_called_instance_1 == NULL) {
1012             assert(HAS_ERROR_OCCURRED(tstate)); 952             assert(HAS_ERROR_OCCURRED(tstate));
1013 953