Construct CallCompiledInstanceMethodPosArgsDefaults_27

Performance Diagrams

Construct CallCompiledInstanceMethodPosArgsDefaults_27 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)20180073588.11538461538461257.0CPython 2.773699796240.03846153846155413.8661918430422Nuitka (main)73699947391.96153846153845413.8660069357718Nuitka (develop)73699788543.8846153846154413.8662016394539Nuitka (factory)Construct CallCompiledInstanceMethodPosArgsDefaults_27Ticks

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
21     inst.compiled_method()
22     inst.compiled_method()
23     # construct_alternative
24 20
25 21
t t 22  
23     # construct_alternative
24     pass
25     # construct_end
26 26
27 27
28 for x in itertools.repeat(None, 50000): 28 for x in itertools.repeat(None, 50000):
29     calledRepeatedly() 29     calledRepeatedly()
30 30

Context Diff of Generated Code


Construct
Baseline
83 static PyCodeObject *codeobj_f7fff8b5a110863c7fac05c59bae08c4; 83 static PyCodeObject *codeobj_f7fff8b5a110863c7fac05c59bae08c4;
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_da74acb040a299af8f803d7d1e5080e7 = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[18], mod_consts[18], NULL, NULL, 0, 0, 0); 89     codeobj_da74acb040a299af8f803d7d1e5080e7 = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[18], mod_consts[18], NULL, NULL, 0, 0, 0);
90     codeobj_main = codeobj_da74acb040a299af8f803d7d1e5080e7; 90     codeobj_main = codeobj_da74acb040a299af8f803d7d1e5080e7;
91     codeobj_9c40777cc05eb3aafa596eef6dbebf4e = MAKE_CODE_OBJECT(module_filename_obj, 14, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[12], mod_consts[12], mod_consts[19], NULL, 0, 0, 0); 91     codeobj_9c40777cc05eb3aafa596eef6dbebf4e = MAKE_CODE_OBJECT(module_filename_obj, 14, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[12], mod_consts[12], mod_consts[19], NULL, 0, 0, 0);
n 92     codeobj_f7fff8b5a110863c7fac05c59bae08c4 = MAKE_CODE_OBJECT(module_filename_obj, 10, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[1], mod_consts[20], mod_consts[21], NULL, 7, 0, 0); n 92     codeobj_f7fff8b5a110863c7fac05c59bae08c4 = MAKE_CODE_OBJECT(module_filename_obj, 10, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[7], mod_consts[20], mod_consts[21], NULL, 7, 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(PyObject *defaults); 96 static PyObject *MAKE_FUNCTION___main__$$$function__1_compiled_method(PyObject *defaults);
97 97
182     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 182     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
183     PyObject *exception_type = NULL; 183     PyObject *exception_type = NULL;
184     PyObject *exception_value = NULL; 184     PyObject *exception_value = NULL;
185     PyTracebackObject *exception_tb = NULL; 185     PyTracebackObject *exception_tb = NULL;
186     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 186     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 187     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; n
188     static struct Nuitka_FrameObject *cache_frame_9c40777cc05eb3aafa596eef6dbebf4e = NULL; 187     static struct Nuitka_FrameObject *cache_frame_9c40777cc05eb3aafa596eef6dbebf4e = NULL;
189     PyObject *tmp_return_value = NULL; 188     PyObject *tmp_return_value = NULL;
190     PyObject *exception_keeper_type_1; 189     PyObject *exception_keeper_type_1;
191     PyObject *exception_keeper_value_1; 190     PyObject *exception_keeper_value_1;
192     PyTracebackObject *exception_keeper_tb_1; 191     PyTracebackObject *exception_keeper_tb_1;
252             type_description_1 = "o"; 251             type_description_1 = "o";
253             goto frame_exception_exit_1; 252             goto frame_exception_exit_1;
254         } 253         }
255         assert(var_inst == NULL); 254         assert(var_inst == NULL);
256         var_inst = tmp_assign_source_1; 255         var_inst = tmp_assign_source_1;
n 257     } n
258     {
259         PyObject *tmp_called_instance_1;
260         PyObject *tmp_call_result_1;
261         CHECK_OBJECT(var_inst);
262         tmp_called_instance_1 = var_inst;
263         frame_9c40777cc05eb3aafa596eef6dbebf4e->m_frame.f_lineno = 20;
264         tmp_call_result_1 = CALL_METHOD_NO_ARGS(tstate, tmp_called_instance_1, mod_consts[1]);
265         if (tmp_call_result_1 == NULL) {
266             assert(HAS_ERROR_OCCURRED(tstate));
267  
268             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
269  
270  
271             exception_lineno = 20;
272             type_description_1 = "o";
273             goto frame_exception_exit_1;
274         }
275         Py_DECREF(tmp_call_result_1);
276     }
277     {
278         PyObject *tmp_called_instance_2;
279         PyObject *tmp_call_result_2;
280         CHECK_OBJECT(var_inst);
281         tmp_called_instance_2 = var_inst;
282         frame_9c40777cc05eb3aafa596eef6dbebf4e->m_frame.f_lineno = 21;
283         tmp_call_result_2 = CALL_METHOD_NO_ARGS(tstate, tmp_called_instance_2, mod_consts[1]);
284         if (tmp_call_result_2 == NULL) {
285             assert(HAS_ERROR_OCCURRED(tstate));
286  
287             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
288  
289  
290             exception_lineno = 21;
291             type_description_1 = "o";
292             goto frame_exception_exit_1;
293         }
294         Py_DECREF(tmp_call_result_2);
295     }
296     {
297         PyObject *tmp_called_instance_3;
298         PyObject *tmp_call_result_3;
299         CHECK_OBJECT(var_inst);
300         tmp_called_instance_3 = var_inst;
301         frame_9c40777cc05eb3aafa596eef6dbebf4e->m_frame.f_lineno = 22;
302         tmp_call_result_3 = CALL_METHOD_NO_ARGS(tstate, tmp_called_instance_3, mod_consts[1]);
303         if (tmp_call_result_3 == NULL) {
304             assert(HAS_ERROR_OCCURRED(tstate));
305  
306             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
307  
308  
309             exception_lineno = 22;
310             type_description_1 = "o";
311             goto frame_exception_exit_1;
312         }
313         Py_DECREF(tmp_call_result_3);
314     } 256     }
315 257
316 258
317     // Put the previous frame back on top. 259     // Put the previous frame back on top.
318     popFrameStack(tstate); 260     popFrameStack(tstate);
373     exception_type = NULL; 315     exception_type = NULL;
374     exception_value = NULL; 316     exception_value = NULL;
375     exception_tb = NULL; 317     exception_tb = NULL;
376     exception_lineno = 0; 318     exception_lineno = 0;
377 319
n 378     Py_XDECREF(var_inst); n
379     var_inst = NULL;
380     // Re-raise. 320     // Re-raise.
381     exception_type = exception_keeper_type_1; 321     exception_type = exception_keeper_type_1;
382     exception_value = exception_keeper_value_1; 322     exception_value = exception_keeper_value_1;
383     exception_tb = exception_keeper_tb_1; 323     exception_tb = exception_keeper_tb_1;
384     exception_lineno = exception_keeper_lineno_1; 324     exception_lineno = exception_keeper_lineno_1;
410 350
411 351
412 static PyObject *MAKE_FUNCTION___main__$$$function__1_compiled_method(PyObject *defaults) { 352 static PyObject *MAKE_FUNCTION___main__$$$function__1_compiled_method(PyObject *defaults) {
413     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 353     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
414         impl___main__$$$function__1_compiled_method, 354         impl___main__$$$function__1_compiled_method,
n 415         mod_consts[1], n 355         mod_consts[7],
416 #if PYTHON_VERSION >= 0x300 356 #if PYTHON_VERSION >= 0x300
417         NULL, 357         NULL,
418 #endif 358 #endif
419         codeobj_f7fff8b5a110863c7fac05c59bae08c4, 359         codeobj_f7fff8b5a110863c7fac05c59bae08c4,
420         defaults, 360         defaults,
837 777
838     // Module code. 778     // Module code.
839     { 779     {
840         PyObject *tmp_assign_source_1; 780         PyObject *tmp_assign_source_1;
841         tmp_assign_source_1 = Py_None; 781         tmp_assign_source_1 = Py_None;
n 842         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1); n 782         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_1);
843     } 783     }
844     { 784     {
845         PyObject *tmp_assign_source_2; 785         PyObject *tmp_assign_source_2;
n 846         tmp_assign_source_2 = mod_consts[3]; n 786         tmp_assign_source_2 = mod_consts[2];
847         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2); 787         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_2);
848     } 788     }
849     { 789     {
850         PyObject *tmp_assign_source_3; 790         PyObject *tmp_assign_source_3;
851         { 791         {
852             PyObject *hard_module = IMPORT_HARD___FUTURE__(); 792             PyObject *hard_module = IMPORT_HARD___FUTURE__();
n 853             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[5]); n 793             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[4]);
854         } 794         }
855         assert(!(tmp_assign_source_3 == NULL)); 795         assert(!(tmp_assign_source_3 == NULL));
n 856         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3); n 796         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_3);
857     } 797     }
858     frame_da74acb040a299af8f803d7d1e5080e7 = MAKE_MODULE_FRAME(codeobj_da74acb040a299af8f803d7d1e5080e7, module___main__); 798     frame_da74acb040a299af8f803d7d1e5080e7 = MAKE_MODULE_FRAME(codeobj_da74acb040a299af8f803d7d1e5080e7, module___main__);
859 799
860     // Push the new frame as the currently active one, and we should be exclusively 800     // Push the new frame as the currently active one, and we should be exclusively
861     // owning it. 801     // owning it.
867         PyObject *tmp_assign_source_4; 807         PyObject *tmp_assign_source_4;
868         PyObject *tmp_name_value_1; 808         PyObject *tmp_name_value_1;
869         PyObject *tmp_globals_arg_value_1; 809         PyObject *tmp_globals_arg_value_1;
870         PyObject *tmp_locals_arg_value_1; 810         PyObject *tmp_locals_arg_value_1;
871         PyObject *tmp_fromlist_value_1; 811         PyObject *tmp_fromlist_value_1;
n 872         tmp_name_value_1 = mod_consts[6]; n 812         tmp_name_value_1 = mod_consts[5];
873         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__; 813         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__;
874         tmp_locals_arg_value_1 = Py_None; 814         tmp_locals_arg_value_1 = Py_None;
875         tmp_fromlist_value_1 = Py_None; 815         tmp_fromlist_value_1 = Py_None;
876         frame_da74acb040a299af8f803d7d1e5080e7->m_frame.f_lineno = 6; 816         frame_da74acb040a299af8f803d7d1e5080e7->m_frame.f_lineno = 6;
877         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); 817         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);
883 823
884             exception_lineno = 6; 824             exception_lineno = 6;
885 825
886             goto frame_exception_exit_1; 826             goto frame_exception_exit_1;
887         } 827         }
n 888         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_4); n 828         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_4);
889     } 829     }
890     { 830     {
891         PyObject *tmp_assign_source_5; 831         PyObject *tmp_assign_source_5;
892         { 832         {
893             PyObject *tmp_assign_source_6; 833             PyObject *tmp_assign_source_6;
894             PyObject *tmp_defaults_1; 834             PyObject *tmp_defaults_1;
n 895             tmp_defaults_1 = mod_consts[7]; n 835             tmp_defaults_1 = mod_consts[6];
896             Py_INCREF(tmp_defaults_1); 836             Py_INCREF(tmp_defaults_1);
897 837
898 838
899             tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function__1_compiled_method(tmp_defaults_1); 839             tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function__1_compiled_method(tmp_defaults_1);
900 840
910             tmp_assign_source_5 = _PyDict_NewPresized( 2 ); 850             tmp_assign_source_5 = _PyDict_NewPresized( 2 );
911             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 851             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
912             assert(!(tmp_res != 0)); 852             assert(!(tmp_res != 0));
913             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method); 853             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method);
914             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method; 854             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method;
n 915             tmp_dict_key_1 = mod_consts[1]; n 855             tmp_dict_key_1 = mod_consts[7];
916             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 856             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
917             assert(!(tmp_res != 0)); 857             assert(!(tmp_res != 0));
918             goto try_return_handler_1; 858             goto try_return_handler_1;
919         } 859         }
920         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases"); 860         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases");
1092     } 1032     }
1093     { 1033     {
1094         PyObject *tmp_assign_source_11; 1034         PyObject *tmp_assign_source_11;
1095         PyObject *tmp_iter_arg_1; 1035         PyObject *tmp_iter_arg_1;
1096         PyObject *tmp_called_instance_1; 1036         PyObject *tmp_called_instance_1;
n 1097         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[6]); n 1037         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[5]);
1098 1038
1099         if (unlikely(tmp_called_instance_1 == NULL)) { 1039         if (unlikely(tmp_called_instance_1 == NULL)) {
t 1100             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[6]); t 1040             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[5]);
1101         } 1041         }
1102 1042
1103         if (tmp_called_instance_1 == NULL) { 1043         if (tmp_called_instance_1 == NULL) {
1104             assert(HAS_ERROR_OCCURRED(tstate)); 1044             assert(HAS_ERROR_OCCURRED(tstate));
1105 1045