Construct CallCompiledObjectMethodNoArgs

Performance Diagrams

Construct CallCompiledObjectMethodNoArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)14417991888.11538461538461257.0CPython 2.728600892240.03846153846155455.0952400282371Nuitka (master)28600508391.96153846153845455.0958981802808Nuitka (develop)28601237543.8846153846154455.09464871976036Nuitka (factory)Construct CallCompiledObjectMethodNoArgsTicks Construct CallCompiledObjectMethodNoArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)13280396988.11538461538461257.0CPython 3.529304152240.03846153846155449.5875956732658Nuitka (master)29301067391.96153846153845449.5933360962914Nuitka (develop)29305799543.8846153846154449.5845310130638Nuitka (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
275     } 275     }
276     assert( var_inst == NULL ); 276     assert( var_inst == NULL );
277     var_inst = tmp_assign_source_1; 277     var_inst = tmp_assign_source_1;
278 278
279     } 279     }
n 280     { n
281     PyObject *tmp_called_instance_1;
282     PyObject *tmp_call_result_1;
283     CHECK_OBJECT( var_inst );
284     tmp_called_instance_1 = var_inst;
285     frame_85ccf3c9871467373ba8036b4d167c25->m_frame.f_lineno = 32;
286     tmp_call_result_1 = CALL_METHOD_NO_ARGS( tmp_called_instance_1, const_str_plain_compiled_method );
287     if ( tmp_call_result_1 == NULL )
288     {
289         assert( ERROR_OCCURRED() );
290  
291         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
292  
293  
294         exception_lineno = 32;
295         type_description_1 = "o";
296         goto frame_exception_exit_1;
297     }
298     Py_DECREF( tmp_call_result_1 );
299     }
300     {
301     PyObject *tmp_called_instance_2;
302     PyObject *tmp_call_result_2;
303     CHECK_OBJECT( var_inst );
304     tmp_called_instance_2 = var_inst;
305     frame_85ccf3c9871467373ba8036b4d167c25->m_frame.f_lineno = 33;
306     tmp_call_result_2 = CALL_METHOD_NO_ARGS( tmp_called_instance_2, const_str_plain_compiled_method );
307     if ( tmp_call_result_2 == NULL )
308     {
309         assert( ERROR_OCCURRED() );
310  
311         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
312  
313  
314         exception_lineno = 33;
315         type_description_1 = "o";
316         goto frame_exception_exit_1;
317     }
318     Py_DECREF( tmp_call_result_2 );
319     }
320     {
321     PyObject *tmp_called_instance_3;
322     PyObject *tmp_call_result_3;
323     CHECK_OBJECT( var_inst );
324     tmp_called_instance_3 = var_inst;
325     frame_85ccf3c9871467373ba8036b4d167c25->m_frame.f_lineno = 34;
326     tmp_call_result_3 = CALL_METHOD_NO_ARGS( tmp_called_instance_3, const_str_plain_compiled_method );
327     if ( tmp_call_result_3 == NULL )
328     {
329         assert( ERROR_OCCURRED() );
330  
331         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
332  
333  
334         exception_lineno = 34;
335         type_description_1 = "o";
336         goto frame_exception_exit_1;
337     }
338     Py_DECREF( tmp_call_result_3 );
339     }
340 280
341 #if 0 281 #if 0
342     RESTORE_FRAME_EXCEPTION( frame_85ccf3c9871467373ba8036b4d167c25 ); 282     RESTORE_FRAME_EXCEPTION( frame_85ccf3c9871467373ba8036b4d167c25 );
343 #endif 283 #endif
344 284
414     exception_type = NULL; 354     exception_type = NULL;
415     exception_value = NULL; 355     exception_value = NULL;
416     exception_tb = NULL; 356     exception_tb = NULL;
417     exception_lineno = 0; 357     exception_lineno = 0;
418 358
t 419     { t
420     Py_XDECREF( var_inst );
421     var_inst = NULL;
422  
423     }
424     { 359     {
425     // Re-raise. 360     // Re-raise.
426     exception_type = exception_keeper_type_1; 361     exception_type = exception_keeper_type_1;
427     exception_value = exception_keeper_value_1; 362     exception_value = exception_keeper_value_1;
428     exception_tb = exception_keeper_tb_1; 363     exception_tb = exception_keeper_tb_1;