Construct CallCompiledInstanceMethodNoArgs_27

Performance Diagrams

Construct CallCompiledInstanceMethodNoArgs_27 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)12060146888.11538461538461257.0CPython 2.735449804240.03846153846155431.47786124792447Nuitka (main)35448874391.96153846153845431.4797668408787Nuitka (develop)35448874543.8846153846154431.4797668408787Nuitka (factory)Construct CallCompiledInstanceMethodNoArgs_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 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_1ffa262e27271ce2217adcd22de5a680; 83 static PyCodeObject *codeobj_1ffa262e27271ce2217adcd22de5a680;
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_b2359cf743398ee2174a9c8c524ca99b = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[16], mod_consts[16], NULL, NULL, 0, 0, 0); 89     codeobj_b2359cf743398ee2174a9c8c524ca99b = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[16], mod_consts[16], NULL, NULL, 0, 0, 0);
90     codeobj_main = codeobj_b2359cf743398ee2174a9c8c524ca99b; 90     codeobj_main = codeobj_b2359cf743398ee2174a9c8c524ca99b;
91     codeobj_81040bb3600195a07cfdd7876e4366ce = MAKE_CODE_OBJECT(module_filename_obj, 14, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[10], mod_consts[10], mod_consts[17], NULL, 0, 0, 0); 91     codeobj_81040bb3600195a07cfdd7876e4366ce = MAKE_CODE_OBJECT(module_filename_obj, 14, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[10], mod_consts[10], mod_consts[17], NULL, 0, 0, 0);
n 92     codeobj_1ffa262e27271ce2217adcd22de5a680 = MAKE_CODE_OBJECT(module_filename_obj, 10, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[1], mod_consts[18], mod_consts[19], NULL, 1, 0, 0); n 92     codeobj_1ffa262e27271ce2217adcd22de5a680 = MAKE_CODE_OBJECT(module_filename_obj, 10, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[6], mod_consts[18], mod_consts[19], 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_81040bb3600195a07cfdd7876e4366ce = NULL; 150     static struct Nuitka_FrameObject *cache_frame_81040bb3600195a07cfdd7876e4366ce = 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_81040bb3600195a07cfdd7876e4366ce->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_81040bb3600195a07cfdd7876e4366ce->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_81040bb3600195a07cfdd7876e4366ce->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_1ffa262e27271ce2217adcd22de5a680, 322         codeobj_1ffa262e27271ce2217adcd22de5a680,
383         NULL, 323         NULL,
792 732
793     // Module code. 733     // Module code.
794     { 734     {
795         PyObject *tmp_assign_source_1; 735         PyObject *tmp_assign_source_1;
796         tmp_assign_source_1 = Py_None; 736         tmp_assign_source_1 = Py_None;
n 797         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1); n 737         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_1);
798     } 738     }
799     { 739     {
800         PyObject *tmp_assign_source_2; 740         PyObject *tmp_assign_source_2;
n 801         tmp_assign_source_2 = mod_consts[3]; n 741         tmp_assign_source_2 = mod_consts[2];
802         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2); 742         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_2);
803     } 743     }
804     { 744     {
805         PyObject *tmp_assign_source_3; 745         PyObject *tmp_assign_source_3;
806         { 746         {
807             PyObject *hard_module = IMPORT_HARD___FUTURE__(); 747             PyObject *hard_module = IMPORT_HARD___FUTURE__();
n 808             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[5]); n 748             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[4]);
809         } 749         }
810         assert(!(tmp_assign_source_3 == NULL)); 750         assert(!(tmp_assign_source_3 == NULL));
n 811         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3); n 751         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_3);
812     } 752     }
813     frame_b2359cf743398ee2174a9c8c524ca99b = MAKE_MODULE_FRAME(codeobj_b2359cf743398ee2174a9c8c524ca99b, module___main__); 753     frame_b2359cf743398ee2174a9c8c524ca99b = MAKE_MODULE_FRAME(codeobj_b2359cf743398ee2174a9c8c524ca99b, module___main__);
814 754
815     // Push the new frame as the currently active one, and we should be exclusively 755     // Push the new frame as the currently active one, and we should be exclusively
816     // owning it. 756     // owning it.
822         PyObject *tmp_assign_source_4; 762         PyObject *tmp_assign_source_4;
823         PyObject *tmp_name_value_1; 763         PyObject *tmp_name_value_1;
824         PyObject *tmp_globals_arg_value_1; 764         PyObject *tmp_globals_arg_value_1;
825         PyObject *tmp_locals_arg_value_1; 765         PyObject *tmp_locals_arg_value_1;
826         PyObject *tmp_fromlist_value_1; 766         PyObject *tmp_fromlist_value_1;
n 827         tmp_name_value_1 = mod_consts[6]; n 767         tmp_name_value_1 = mod_consts[5];
828         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__; 768         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__;
829         tmp_locals_arg_value_1 = Py_None; 769         tmp_locals_arg_value_1 = Py_None;
830         tmp_fromlist_value_1 = Py_None; 770         tmp_fromlist_value_1 = Py_None;
831         frame_b2359cf743398ee2174a9c8c524ca99b->m_frame.f_lineno = 6; 771         frame_b2359cf743398ee2174a9c8c524ca99b->m_frame.f_lineno = 6;
832         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); 772         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);
838 778
839             exception_lineno = 6; 779             exception_lineno = 6;
840 780
841             goto frame_exception_exit_1; 781             goto frame_exception_exit_1;
842         } 782         }
n 843         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_4); n 783         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_4);
844     } 784     }
845     { 785     {
846         PyObject *tmp_assign_source_5; 786         PyObject *tmp_assign_source_5;
847         { 787         {
848             PyObject *tmp_assign_source_6; 788             PyObject *tmp_assign_source_6;
862             tmp_assign_source_5 = _PyDict_NewPresized( 2 ); 802             tmp_assign_source_5 = _PyDict_NewPresized( 2 );
863             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 803             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
864             assert(!(tmp_res != 0)); 804             assert(!(tmp_res != 0));
865             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method); 805             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method);
866             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method; 806             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method;
n 867             tmp_dict_key_1 = mod_consts[1]; n 807             tmp_dict_key_1 = mod_consts[6];
868             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 808             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
869             assert(!(tmp_res != 0)); 809             assert(!(tmp_res != 0));
870             goto try_return_handler_1; 810             goto try_return_handler_1;
871         } 811         }
872         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases"); 812         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases");
1044     } 984     }
1045     { 985     {
1046         PyObject *tmp_assign_source_11; 986         PyObject *tmp_assign_source_11;
1047         PyObject *tmp_iter_arg_1; 987         PyObject *tmp_iter_arg_1;
1048         PyObject *tmp_called_instance_1; 988         PyObject *tmp_called_instance_1;
n 1049         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[6]); n 989         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[5]);
1050 990
1051         if (unlikely(tmp_called_instance_1 == NULL)) { 991         if (unlikely(tmp_called_instance_1 == NULL)) {
t 1052             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[6]); t 992             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[5]);
1053         } 993         }
1054 994
1055         if (tmp_called_instance_1 == NULL) { 995         if (tmp_called_instance_1 == NULL) {
1056             assert(HAS_ERROR_OCCURRED(tstate)); 996             assert(HAS_ERROR_OCCURRED(tstate));
1057 997