Construct CallCompiledObjectMethodNoArgs

Performance Diagrams

Construct CallCompiledObjectMethodNoArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000CPython 3.10Nuitka (main)Nuitka (develop)Nuitka (factory)10298822088.11538461538461257.0CPython 3.1032200515240.03846153846155426.85176505735694Nuitka (main)32200507391.96153846153845426.8517842529802Nuitka (develop)32200507543.8846153846154426.8517842529802Nuitka (factory)Construct CallCompiledObjectMethodNoArgsTicks Construct CallCompiledObjectMethodNoArgs 0010000000100000002000000020000000300000003000000040000000400000005000000050000000600000006000000070000000700000008000000080000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)8826305588.95192307692307257.0CPython 3.828000409242.31730769230768425.72095515196895Nuitka (main)28000413395.6826923076923425.72094395292834Nuitka (develop)28000413549.0480769230769425.72094395292834Nuitka (factory)Construct CallCompiledObjectMethodNoArgsTicks Construct CallCompiledObjectMethodNoArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)11475157988.11538461538461257.0CPython 2.730950908240.03846153846155437.4631816455642Nuitka (main)30949914391.96153846153845437.4653222060205Nuitka (develop)30949914543.8846153846154437.4653222060205Nuitka (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_8382aa20adc1d7ac923a5824d818f3d0; 83 static PyCodeObject *codeobj_8382aa20adc1d7ac923a5824d818f3d0;
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_3c551dadb20109da8e977af05025b989 = 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_3c551dadb20109da8e977af05025b989 = 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_3c551dadb20109da8e977af05025b989; 90     codeobj_main = codeobj_3c551dadb20109da8e977af05025b989;
91     codeobj_877aa8fa427171fe6715c7e4378703c1 = 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_877aa8fa427171fe6715c7e4378703c1 = 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_8382aa20adc1d7ac923a5824d818f3d0 = 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_8382aa20adc1d7ac923a5824d818f3d0 = 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_877aa8fa427171fe6715c7e4378703c1 = NULL; 150     static struct Nuitka_FrameObject *cache_frame_877aa8fa427171fe6715c7e4378703c1 = 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_877aa8fa427171fe6715c7e4378703c1->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_877aa8fa427171fe6715c7e4378703c1->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_877aa8fa427171fe6715c7e4378703c1->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_8382aa20adc1d7ac923a5824d818f3d0, 322         codeobj_8382aa20adc1d7ac923a5824d818f3d0,
383         NULL, 323         NULL,
796 736
797     // Module code. 737     // Module code.
798     { 738     {
799         PyObject *tmp_assign_source_1; 739         PyObject *tmp_assign_source_1;
800         tmp_assign_source_1 = Py_None; 740         tmp_assign_source_1 = Py_None;
n 801         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1); n 741         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_1);
802     } 742     }
803     { 743     {
804         PyObject *tmp_assign_source_2; 744         PyObject *tmp_assign_source_2;
n 805         tmp_assign_source_2 = mod_consts[3]; n 745         tmp_assign_source_2 = mod_consts[2];
806         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2); 746         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_2);
807     } 747     }
808     { 748     {
809         PyObject *tmp_assign_source_3; 749         PyObject *tmp_assign_source_3;
810         { 750         {
811             PyObject *hard_module = IMPORT_HARD___FUTURE__(); 751             PyObject *hard_module = IMPORT_HARD___FUTURE__();
n 812             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[5]); n 752             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[4]);
813         } 753         }
814         assert(!(tmp_assign_source_3 == NULL)); 754         assert(!(tmp_assign_source_3 == NULL));
n 815         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3); n 755         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_3);
816     } 756     }
817     frame_3c551dadb20109da8e977af05025b989 = MAKE_MODULE_FRAME(codeobj_3c551dadb20109da8e977af05025b989, module___main__); 757     frame_3c551dadb20109da8e977af05025b989 = MAKE_MODULE_FRAME(codeobj_3c551dadb20109da8e977af05025b989, module___main__);
818 758
819     // Push the new frame as the currently active one, and we should be exclusively 759     // Push the new frame as the currently active one, and we should be exclusively
820     // owning it. 760     // owning it.
826         PyObject *tmp_assign_source_4; 766         PyObject *tmp_assign_source_4;
827         PyObject *tmp_name_value_1; 767         PyObject *tmp_name_value_1;
828         PyObject *tmp_globals_arg_value_1; 768         PyObject *tmp_globals_arg_value_1;
829         PyObject *tmp_locals_arg_value_1; 769         PyObject *tmp_locals_arg_value_1;
830         PyObject *tmp_fromlist_value_1; 770         PyObject *tmp_fromlist_value_1;
n 831         tmp_name_value_1 = mod_consts[6]; n 771         tmp_name_value_1 = mod_consts[5];
832         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__; 772         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__;
833         tmp_locals_arg_value_1 = Py_None; 773         tmp_locals_arg_value_1 = Py_None;
834         tmp_fromlist_value_1 = Py_None; 774         tmp_fromlist_value_1 = Py_None;
835         frame_3c551dadb20109da8e977af05025b989->m_frame.f_lineno = 6; 775         frame_3c551dadb20109da8e977af05025b989->m_frame.f_lineno = 6;
836         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); 776         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);
842 782
843             exception_lineno = 6; 783             exception_lineno = 6;
844 784
845             goto frame_exception_exit_1; 785             goto frame_exception_exit_1;
846         } 786         }
n 847         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_4); n 787         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_4);
848     } 788     }
849     { 789     {
850         PyObject *tmp_assign_source_5; 790         PyObject *tmp_assign_source_5;
851         { 791         {
852             PyObject *tmp_assign_source_6; 792             PyObject *tmp_assign_source_6;
866             tmp_assign_source_5 = _PyDict_NewPresized( 2 ); 806             tmp_assign_source_5 = _PyDict_NewPresized( 2 );
867             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 807             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
868             assert(!(tmp_res != 0)); 808             assert(!(tmp_res != 0));
869             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method); 809             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method);
870             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method; 810             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method;
n 871             tmp_dict_key_1 = mod_consts[1]; n 811             tmp_dict_key_1 = mod_consts[6];
872             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 812             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
873             assert(!(tmp_res != 0)); 813             assert(!(tmp_res != 0));
874             goto try_return_handler_1; 814             goto try_return_handler_1;
875         } 815         }
876         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases"); 816         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases");
1008     } 948     }
1009     { 949     {
1010         PyObject *tmp_assign_source_11; 950         PyObject *tmp_assign_source_11;
1011         PyObject *tmp_iter_arg_1; 951         PyObject *tmp_iter_arg_1;
1012         PyObject *tmp_called_instance_1; 952         PyObject *tmp_called_instance_1;
n 1013         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[6]); n 953         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[5]);
1014 954
1015         if (unlikely(tmp_called_instance_1 == NULL)) { 955         if (unlikely(tmp_called_instance_1 == NULL)) {
t 1016             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[6]); t 956             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[5]);
1017         } 957         }
1018 958
1019         if (tmp_called_instance_1 == NULL) { 959         if (tmp_called_instance_1 == NULL) {
1020             assert(HAS_ERROR_OCCURRED(tstate)); 960             assert(HAS_ERROR_OCCURRED(tstate));
1021 961