Construct CallCompiledInstanceMethodNoArgs_27

Performance Diagrams

Construct CallCompiledInstanceMethodNoArgs_27 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)12060146888.11538461538461257.0CPython 2.735449996240.03846153846155431.4774678351855Nuitka (main)35449924391.96153846153845431.4776153649626Nuitka (develop)35449924543.8846153846154431.4776153649626Nuitka (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_7ce5b8749132a2d023692b644ddee1cf; 83 static PyCodeObject *codeobj_7ce5b8749132a2d023692b644ddee1cf;
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_b7735e16052ff937f297f9ff3be721c5 = 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_b7735e16052ff937f297f9ff3be721c5 = 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_b7735e16052ff937f297f9ff3be721c5; 90     codeobj_main = codeobj_b7735e16052ff937f297f9ff3be721c5;
91     codeobj_5cb4b20e971a000a6eefc5d67ba068b2 = 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_5cb4b20e971a000a6eefc5d67ba068b2 = 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_7ce5b8749132a2d023692b644ddee1cf = MAKE_CODE_OBJECT(module_filename_obj, 10, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[1], mod_consts[1], mod_consts[19], NULL, 1, 0, 0); n 92     codeobj_7ce5b8749132a2d023692b644ddee1cf = MAKE_CODE_OBJECT(module_filename_obj, 10, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_PRINT_FUNCTION, mod_consts[6], mod_consts[6], 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_5cb4b20e971a000a6eefc5d67ba068b2 = NULL; 150     static struct Nuitka_FrameObject *cache_frame_5cb4b20e971a000a6eefc5d67ba068b2 = 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_5cb4b20e971a000a6eefc5d67ba068b2->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_5cb4b20e971a000a6eefc5d67ba068b2->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_5cb4b20e971a000a6eefc5d67ba068b2->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_7ce5b8749132a2d023692b644ddee1cf, 322         codeobj_7ce5b8749132a2d023692b644ddee1cf,
383         NULL, 323         NULL,
800 740
801     // Module code. 741     // Module code.
802     { 742     {
803         PyObject *tmp_assign_source_1; 743         PyObject *tmp_assign_source_1;
804         tmp_assign_source_1 = Py_None; 744         tmp_assign_source_1 = Py_None;
n 805         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1); n 745         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_1);
806     } 746     }
807     { 747     {
808         PyObject *tmp_assign_source_2; 748         PyObject *tmp_assign_source_2;
n 809         tmp_assign_source_2 = mod_consts[3]; n 749         tmp_assign_source_2 = mod_consts[2];
810         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2); 750         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_2);
811     } 751     }
812     { 752     {
813         PyObject *tmp_assign_source_3; 753         PyObject *tmp_assign_source_3;
814         { 754         {
815             PyObject *hard_module = IMPORT_HARD___FUTURE__(); 755             PyObject *hard_module = IMPORT_HARD___FUTURE__();
n 816             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[5]); n 756             tmp_assign_source_3 = LOOKUP_ATTRIBUTE(tstate, hard_module, mod_consts[4]);
817         } 757         }
818         assert(!(tmp_assign_source_3 == NULL)); 758         assert(!(tmp_assign_source_3 == NULL));
n 819         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3); n 759         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_3);
820     } 760     }
821     frame_b7735e16052ff937f297f9ff3be721c5 = MAKE_MODULE_FRAME(codeobj_b7735e16052ff937f297f9ff3be721c5, module___main__); 761     frame_b7735e16052ff937f297f9ff3be721c5 = MAKE_MODULE_FRAME(codeobj_b7735e16052ff937f297f9ff3be721c5, module___main__);
822 762
823     // Push the new frame as the currently active one, and we should be exclusively 763     // Push the new frame as the currently active one, and we should be exclusively
824     // owning it. 764     // owning it.
830         PyObject *tmp_assign_source_4; 770         PyObject *tmp_assign_source_4;
831         PyObject *tmp_name_value_1; 771         PyObject *tmp_name_value_1;
832         PyObject *tmp_globals_arg_value_1; 772         PyObject *tmp_globals_arg_value_1;
833         PyObject *tmp_locals_arg_value_1; 773         PyObject *tmp_locals_arg_value_1;
834         PyObject *tmp_fromlist_value_1; 774         PyObject *tmp_fromlist_value_1;
n 835         tmp_name_value_1 = mod_consts[6]; n 775         tmp_name_value_1 = mod_consts[5];
836         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__; 776         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__;
837         tmp_locals_arg_value_1 = Py_None; 777         tmp_locals_arg_value_1 = Py_None;
838         tmp_fromlist_value_1 = Py_None; 778         tmp_fromlist_value_1 = Py_None;
839         frame_b7735e16052ff937f297f9ff3be721c5->m_frame.f_lineno = 6; 779         frame_b7735e16052ff937f297f9ff3be721c5->m_frame.f_lineno = 6;
840         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); 780         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);
846 786
847             exception_lineno = 6; 787             exception_lineno = 6;
848 788
849             goto frame_exception_exit_1; 789             goto frame_exception_exit_1;
850         } 790         }
n 851         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_4); n 791         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_4);
852     } 792     }
853     { 793     {
854         PyObject *tmp_assign_source_5; 794         PyObject *tmp_assign_source_5;
855         { 795         {
856             PyObject *tmp_assign_source_6; 796             PyObject *tmp_assign_source_6;
870             tmp_assign_source_5 = _PyDict_NewPresized( 2 ); 810             tmp_assign_source_5 = _PyDict_NewPresized( 2 );
871             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 811             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
872             assert(!(tmp_res != 0)); 812             assert(!(tmp_res != 0));
873             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method); 813             CHECK_OBJECT(tmp_locals___main__$$$class__1_C_9_key_compiled_method);
874             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method; 814             tmp_dict_value_1 = tmp_locals___main__$$$class__1_C_9_key_compiled_method;
n 875             tmp_dict_key_1 = mod_consts[1]; n 815             tmp_dict_key_1 = mod_consts[6];
876             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1); 816             tmp_res = PyDict_SetItem(tmp_assign_source_5, tmp_dict_key_1, tmp_dict_value_1);
877             assert(!(tmp_res != 0)); 817             assert(!(tmp_res != 0));
878             goto try_return_handler_1; 818             goto try_return_handler_1;
879         } 819         }
880         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases"); 820         NUITKA_CANNOT_GET_HERE("tried codes exits in all cases");
1052     } 992     }
1053     { 993     {
1054         PyObject *tmp_assign_source_11; 994         PyObject *tmp_assign_source_11;
1055         PyObject *tmp_iter_arg_1; 995         PyObject *tmp_iter_arg_1;
1056         PyObject *tmp_called_instance_1; 996         PyObject *tmp_called_instance_1;
n 1057         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[6]); n 997         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[5]);
1058 998
1059         if (unlikely(tmp_called_instance_1 == NULL)) { 999         if (unlikely(tmp_called_instance_1 == NULL)) {
t 1060             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[6]); t 1000             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[5]);
1061         } 1001         }
1062 1002
1063         if (tmp_called_instance_1 == NULL) { 1003         if (tmp_called_instance_1 == NULL) {
1064             assert(HAS_ERROR_OCCURRED(tstate)); 1004             assert(HAS_ERROR_OCCURRED(tstate));
1065 1005