Construct CallCompiledObjectMethodPosArgsDefaults

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsDefaults 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000240000000240000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)24202407088.11538461538461257.0CPython 2.780200832240.03846153846155422.2274160089818Nuitka (master)80201478391.96153846153845422.22675641946876Nuitka (develop)80201385543.8846153846154422.2268513758538Nuitka (factory)Construct CallCompiledObjectMethodPosArgsDefaultsTicks Construct CallCompiledObjectMethodPosArgsDefaults 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)23660636688.11538461538461257.0CPython 3.580601337240.03846153846155419.9340892005807Nuitka (master)80152006391.96153846153845420.4033775158605Nuitka (develop)80151080543.8846153846154420.40434464472526Nuitka (factory)Construct CallCompiledObjectMethodPosArgsDefaultsTicks

Source Code with Construct

from __future__ import print_function

class C(object):
    def compiled_method(self, a = 1, b = 2,c = 3,d = 4,e = 5,f = 6):
        return a, b, c, d, e, f

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, a = 1, b = 2,c = 3,d = 4,e = 5,f = 6):
        return a, b, c, d, e, f

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
33     inst.compiled_method()
34     inst.compiled_method()
35 # construct_alternative
36 32
37 33
t t 34  
35 # construct_alternative
36     pass
37 # construct_end
38 38
39 import itertools 39 import itertools
40 for x in itertools.repeat(None, 50000): 40 for x in itertools.repeat(None, 50000):
41     calledRepeatedly() 41     calledRepeatedly()
42 42

Context Diff of Generated Code


Construct
Baseline
379     } 379     }
380     assert( var_inst == NULL ); 380     assert( var_inst == NULL );
381     var_inst = tmp_assign_source_1; 381     var_inst = tmp_assign_source_1;
382 382
383     } 383     }
n 384     { n
385     PyObject *tmp_called_instance_1;
386     PyObject *tmp_call_result_1;
387     CHECK_OBJECT( var_inst );
388     tmp_called_instance_1 = var_inst;
389     frame_40eac6b8bc9cd7466b763bdee642b0f7->m_frame.f_lineno = 32;
390     tmp_call_result_1 = CALL_METHOD_NO_ARGS( tmp_called_instance_1, const_str_plain_compiled_method );
391     if ( tmp_call_result_1 == NULL )
392     {
393         assert( ERROR_OCCURRED() );
394  
395         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
396  
397  
398         exception_lineno = 32;
399         type_description_1 = "o";
400         goto frame_exception_exit_1;
401     }
402     Py_DECREF( tmp_call_result_1 );
403     }
404     {
405     PyObject *tmp_called_instance_2;
406     PyObject *tmp_call_result_2;
407     CHECK_OBJECT( var_inst );
408     tmp_called_instance_2 = var_inst;
409     frame_40eac6b8bc9cd7466b763bdee642b0f7->m_frame.f_lineno = 33;
410     tmp_call_result_2 = CALL_METHOD_NO_ARGS( tmp_called_instance_2, const_str_plain_compiled_method );
411     if ( tmp_call_result_2 == NULL )
412     {
413         assert( ERROR_OCCURRED() );
414  
415         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
416  
417  
418         exception_lineno = 33;
419         type_description_1 = "o";
420         goto frame_exception_exit_1;
421     }
422     Py_DECREF( tmp_call_result_2 );
423     }
424     {
425     PyObject *tmp_called_instance_3;
426     PyObject *tmp_call_result_3;
427     CHECK_OBJECT( var_inst );
428     tmp_called_instance_3 = var_inst;
429     frame_40eac6b8bc9cd7466b763bdee642b0f7->m_frame.f_lineno = 34;
430     tmp_call_result_3 = CALL_METHOD_NO_ARGS( tmp_called_instance_3, const_str_plain_compiled_method );
431     if ( tmp_call_result_3 == NULL )
432     {
433         assert( ERROR_OCCURRED() );
434  
435         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
436  
437  
438         exception_lineno = 34;
439         type_description_1 = "o";
440         goto frame_exception_exit_1;
441     }
442     Py_DECREF( tmp_call_result_3 );
443     }
444 384
445 #if 0 385 #if 0
446     RESTORE_FRAME_EXCEPTION( frame_40eac6b8bc9cd7466b763bdee642b0f7 ); 386     RESTORE_FRAME_EXCEPTION( frame_40eac6b8bc9cd7466b763bdee642b0f7 );
447 #endif 387 #endif
448 388
518     exception_type = NULL; 458     exception_type = NULL;
519     exception_value = NULL; 459     exception_value = NULL;
520     exception_tb = NULL; 460     exception_tb = NULL;
521     exception_lineno = 0; 461     exception_lineno = 0;
522 462
t 523     { t
524     Py_XDECREF( var_inst );
525     var_inst = NULL;
526  
527     }
528     { 463     {
529     // Re-raise. 464     // Re-raise.
530     exception_type = exception_keeper_type_1; 465     exception_type = exception_keeper_type_1;
531     exception_value = exception_keeper_value_1; 466     exception_value = exception_keeper_value_1;
532     exception_tb = exception_keeper_tb_1; 467     exception_tb = exception_keeper_tb_1;