Construct CallCompiledInstanceMethodPosArgsDefaults_27

Performance Diagrams

Construct CallCompiledInstanceMethodPosArgsDefaults_27 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)20180073588.11538461538461257.0CPython 2.773699766240.03846153846155413.866228579586Nuitka (main)73698750391.96153846153845413.86747272386907Nuitka (develop)73698750543.8846153846154413.86747272386907Nuitka (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_54dd1bac0bcc6cfd98860185b70ec168; 83 static PyCodeObject *codeobj_54dd1bac0bcc6cfd98860185b70ec168;
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_5ced15cf264b3c6e0ad502bf1b1b7296 = 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_5ced15cf264b3c6e0ad502bf1b1b7296 = 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_5ced15cf264b3c6e0ad502bf1b1b7296; 90     codeobj_main = codeobj_5ced15cf264b3c6e0ad502bf1b1b7296;
91     codeobj_3b203cf99fdee15e69d605c154f68eb1 = 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_3b203cf99fdee15e69d605c154f68eb1 = 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_54dd1bac0bcc6cfd98860185b70ec168 = 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, 7, 0, 0); n 92     codeobj_54dd1bac0bcc6cfd98860185b70ec168 = MAKE_CODE_OBJECT(module_filename_obj, 10, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[7], mod_consts[19], mod_consts[20], 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_3b203cf99fdee15e69d605c154f68eb1 = NULL; 187     static struct Nuitka_FrameObject *cache_frame_3b203cf99fdee15e69d605c154f68eb1 = 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_3b203cf99fdee15e69d605c154f68eb1->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_3b203cf99fdee15e69d605c154f68eb1->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_3b203cf99fdee15e69d605c154f68eb1->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_54dd1bac0bcc6cfd98860185b70ec168, 359         codeobj_54dd1bac0bcc6cfd98860185b70ec168,
420         defaults, 360         defaults,
829 769
830     // Module code. 770     // Module code.
831     { 771     {
832         PyObject *tmp_assign_source_1; 772         PyObject *tmp_assign_source_1;
833         tmp_assign_source_1 = Py_None; 773         tmp_assign_source_1 = Py_None;
n 834         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1); n 774         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_1);
835     } 775     }
836     { 776     {
837         PyObject *tmp_assign_source_2; 777         PyObject *tmp_assign_source_2;
n 838         tmp_assign_source_2 = mod_consts[3]; n 778         tmp_assign_source_2 = mod_consts[2];
839         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2); 779         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_2);
840     } 780     }
841     { 781     {
842         PyObject *tmp_assign_source_3; 782         PyObject *tmp_assign_source_3;
843         { 783         {
844             PyObject *hard_module = IMPORT_HARD___FUTURE__(); 784             PyObject *hard_module = IMPORT_HARD___FUTURE__();
n 845             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[5]); n 785             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[4]);
846         } 786         }
847         assert(!(tmp_assign_source_3 == NULL)); 787         assert(!(tmp_assign_source_3 == NULL));
n 848         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3); n 788         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_3);
849     } 789     }
850     frame_5ced15cf264b3c6e0ad502bf1b1b7296 = MAKE_MODULE_FRAME(codeobj_5ced15cf264b3c6e0ad502bf1b1b7296, module___main__); 790     frame_5ced15cf264b3c6e0ad502bf1b1b7296 = MAKE_MODULE_FRAME(codeobj_5ced15cf264b3c6e0ad502bf1b1b7296, module___main__);
851 791
852     // Push the new frame as the currently active one, and we should be exclusively 792     // Push the new frame as the currently active one, and we should be exclusively
853     // owning it. 793     // owning it.
859         PyObject *tmp_assign_source_4; 799         PyObject *tmp_assign_source_4;
860         PyObject *tmp_name_value_1; 800         PyObject *tmp_name_value_1;
861         PyObject *tmp_globals_arg_value_1; 801         PyObject *tmp_globals_arg_value_1;
862         PyObject *tmp_locals_arg_value_1; 802         PyObject *tmp_locals_arg_value_1;
863         PyObject *tmp_fromlist_value_1; 803         PyObject *tmp_fromlist_value_1;
n 864         tmp_name_value_1 = mod_consts[6]; n 804         tmp_name_value_1 = mod_consts[5];
865         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__; 805         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__;
866         tmp_locals_arg_value_1 = Py_None; 806         tmp_locals_arg_value_1 = Py_None;
867         tmp_fromlist_value_1 = Py_None; 807         tmp_fromlist_value_1 = Py_None;
868         frame_5ced15cf264b3c6e0ad502bf1b1b7296->m_frame.f_lineno = 6; 808         frame_5ced15cf264b3c6e0ad502bf1b1b7296->m_frame.f_lineno = 6;
869         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); 809         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);
875 815
876             exception_lineno = 6; 816             exception_lineno = 6;
877 817
878             goto frame_exception_exit_1; 818             goto frame_exception_exit_1;
879         } 819         }
n 880         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_4); n 820         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_4);
881     } 821     }
882     { 822     {
883         PyObject *tmp_assign_source_5; 823         PyObject *tmp_assign_source_5;
884         { 824         {
885             PyObject *tmp_assign_source_6; 825             PyObject *tmp_assign_source_6;
886             PyObject *tmp_defaults_1; 826             PyObject *tmp_defaults_1;
n 887             tmp_defaults_1 = mod_consts[7]; n 827             tmp_defaults_1 = mod_consts[6];
888             Py_INCREF(tmp_defaults_1); 828             Py_INCREF(tmp_defaults_1);
889 829
890 830
891             tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function__1_compiled_method(tmp_defaults_1); 831             tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function__1_compiled_method(tmp_defaults_1);
892 832
902             tmp_assign_source_5 = _PyDict_NewPresized( 2 ); 842             tmp_assign_source_5 = _PyDict_NewPresized( 2 );
903             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 843             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
904             assert(!(tmp_res != 0)); 844             assert(!(tmp_res != 0));
905             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method); 845             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method);
906             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method; 846             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method;
n 907             tmp_dict_key_1 = mod_consts[1]; n 847             tmp_dict_key_1 = mod_consts[7];
908             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 848             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
909             assert(!(tmp_res != 0)); 849             assert(!(tmp_res != 0));
910             goto try_return_handler_1; 850             goto try_return_handler_1;
911         } 851         }
912         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases"); 852         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases");
1084     } 1024     }
1085     { 1025     {
1086         PyObject *tmp_assign_source_11; 1026         PyObject *tmp_assign_source_11;
1087         PyObject *tmp_iter_arg_1; 1027         PyObject *tmp_iter_arg_1;
1088         PyObject *tmp_called_instance_1; 1028         PyObject *tmp_called_instance_1;
n 1089         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[6]); n 1029         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[5]);
1090 1030
1091         if (unlikely(tmp_called_instance_1 == NULL)) { 1031         if (unlikely(tmp_called_instance_1 == NULL)) {
t 1092             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[6]); t 1032             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[5]);
1093         } 1033         }
1094 1034
1095         if (tmp_called_instance_1 == NULL) { 1035         if (tmp_called_instance_1 == NULL) {
1096             assert(HAS_ERROR_OCCURRED(tstate)); 1036             assert(HAS_ERROR_OCCURRED(tstate));
1097 1037