Construct CallCompiledObjectMethodNoArgs

Performance Diagrams

Construct CallCompiledObjectMethodNoArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)13233841788.11538461538461257.00000000000006CPython 2.729101263240.03846153846155449.77462732010537Nuitka (master)29101115391.96153846153845449.77490368034717Nuitka (develop)29101187543.8846153846154449.77476923482413Nuitka (factory)Construct CallCompiledObjectMethodNoArgsTicks Construct CallCompiledObjectMethodNoArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)12905780488.11538461538461257.0CPython 3.529948643240.03846153846155446.7707668993273Nuitka (master)29956326391.96153846153845446.7560557587287Nuitka (develop)29952716543.8846153846154446.76296806089726Nuitka (factory)Construct CallCompiledObjectMethodNoArgsTicks

Source Code with Construct

from __future__ import print_function

class C(object):
    def compiled_method(self):
        return self

def calledRepeatedly():
    inst = C()

    # This is supposed to make a call to a non-compiled function, which is
    # being optimized separately.
# construct_begin
    inst.compiled_method()
    inst.compiled_method()
    inst.compiled_method()

# construct_alternative



import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

from __future__ import print_function

class C(object):
    def compiled_method(self):
        return self

def calledRepeatedly():
    inst = C()

    # This is supposed to make a call to a non-compiled function, which is
    # being optimized separately.
# construct_begin




# construct_alternative
    pass
# construct_end

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
27     inst = C() 27     inst = C()
28 28
29     # This is supposed to make a call to a non-compiled function, which is 29     # This is supposed to make a call to a non-compiled function, which is
30     # being optimized separately. 30     # being optimized separately.
31 # construct_begin 31 # construct_begin
n 32     inst.compiled_method() n 32  
33     inst.compiled_method() 33  
34     inst.compiled_method() 34  
35 35
36 # construct_alternative 36 # construct_alternative
t 37   t 37     pass
38   38 # construct_end
39 39
40 import itertools 40 import itertools
41 for x in itertools.repeat(None, 50000): 41 for x in itertools.repeat(None, 50000):
42     calledRepeatedly() 42     calledRepeatedly()
43 43

Context Diff of Generated Code


Construct
Baseline
259             goto frame_exception_exit_1; 259             goto frame_exception_exit_1;
260         } 260         }
261         assert(var_inst == NULL); 261         assert(var_inst == NULL);
262         var_inst = tmp_assign_source_1; 262         var_inst = tmp_assign_source_1;
263     } 263     }
n 264     { n
265         PyObject *tmp_called_instance_1;
266         PyObject *tmp_call_result_1;
267         CHECK_OBJECT(var_inst);
268         tmp_called_instance_1 = var_inst;
269         frame_c99ae1bd70d27ed97767fbd9e573dc26->m_frame.f_lineno = 32;
270         tmp_call_result_1 = CALL_METHOD_NO_ARGS( tmp_called_instance_1, const_str_plain_compiled_method );
271         if ( tmp_call_result_1 == NULL )
272         {
273             assert(ERROR_OCCURRED());
274  
275             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
276  
277  
278             exception_lineno = 32;
279             type_description_1 = "o";
280             goto frame_exception_exit_1;
281         }
282         Py_DECREF(tmp_call_result_1);
283     }
284     {
285         PyObject *tmp_called_instance_2;
286         PyObject *tmp_call_result_2;
287         CHECK_OBJECT(var_inst);
288         tmp_called_instance_2 = var_inst;
289         frame_c99ae1bd70d27ed97767fbd9e573dc26->m_frame.f_lineno = 33;
290         tmp_call_result_2 = CALL_METHOD_NO_ARGS( tmp_called_instance_2, const_str_plain_compiled_method );
291         if ( tmp_call_result_2 == NULL )
292         {
293             assert(ERROR_OCCURRED());
294  
295             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
296  
297  
298             exception_lineno = 33;
299             type_description_1 = "o";
300             goto frame_exception_exit_1;
301         }
302         Py_DECREF(tmp_call_result_2);
303     }
304     {
305         PyObject *tmp_called_instance_3;
306         PyObject *tmp_call_result_3;
307         CHECK_OBJECT(var_inst);
308         tmp_called_instance_3 = var_inst;
309         frame_c99ae1bd70d27ed97767fbd9e573dc26->m_frame.f_lineno = 34;
310         tmp_call_result_3 = CALL_METHOD_NO_ARGS( tmp_called_instance_3, const_str_plain_compiled_method );
311         if ( tmp_call_result_3 == NULL )
312         {
313             assert(ERROR_OCCURRED());
314  
315             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
316  
317  
318             exception_lineno = 34;
319             type_description_1 = "o";
320             goto frame_exception_exit_1;
321         }
322         Py_DECREF(tmp_call_result_3);
323     }
324 264
325 #if 0 265 #if 0
326     RESTORE_FRAME_EXCEPTION(frame_c99ae1bd70d27ed97767fbd9e573dc26); 266     RESTORE_FRAME_EXCEPTION(frame_c99ae1bd70d27ed97767fbd9e573dc26);
327 #endif 267 #endif
328 268
388     exception_keeper_lineno_1 = exception_lineno; 328     exception_keeper_lineno_1 = exception_lineno;
389     exception_type = NULL; 329     exception_type = NULL;
390     exception_value = NULL; 330     exception_value = NULL;
391     exception_tb = NULL; 331     exception_tb = NULL;
392     exception_lineno = 0; 332     exception_lineno = 0;
t 393   t
394     Py_XDECREF(var_inst);
395     var_inst = NULL;
396 333
397     // Re-raise. 334     // Re-raise.
398     exception_type = exception_keeper_type_1; 335     exception_type = exception_keeper_type_1;
399     exception_value = exception_keeper_value_1; 336     exception_value = exception_keeper_value_1;
400     exception_tb = exception_keeper_tb_1; 337     exception_tb = exception_keeper_tb_1;