Construct CallCompiledObjectMethodPosArgsVariable

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsVariable 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000240000000240000000260000000260000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)27547007988.11538461538461257.0CPython 2.788901278240.03846153846155424.36489561302284Nuitka (master)88901314391.96153846153845424.3648633185759Nuitka (develop)88901256543.8846153846154424.3649153485182Nuitka (factory)Construct CallCompiledObjectMethodPosArgsVariableTicks Construct CallCompiledObjectMethodPosArgsVariable 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000240000000240000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)25911146288.11538461538461257.0CPython 3.588003040240.03846153846155420.1866193301072Nuitka (master)88002188391.96153846153845420.18743188508284Nuitka (develop)88002786543.8846153846154420.1868615706751Nuitka (factory)Construct CallCompiledObjectMethodPosArgsVariableTicks

Source Code with Construct

from __future__ import print_function

class C(object):
    def compiled_method(self, a,b,c,d,e,f):
        return a, b, c, d, e, f

def getUnknownValue():
    return 8

def calledRepeatedly():
    a = getUnknownValue()
    b = getUnknownValue()
    c = getUnknownValue()
    d = getUnknownValue()
    e = getUnknownValue()
    f = getUnknownValue()

    inst = C()

    # This is supposed to make a call to a non-compiled function, which is
    # being optimized separately.
# construct_begin
    inst.compiled_method(a, b, c, d, e, f)
    inst.compiled_method(a, c, b, d, e, f)
    inst.compiled_method(a, b, c, d, f, e)
# 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,b,c,d,e,f):
        return a, b, c, d, e, f

def getUnknownValue():
    return 8

def calledRepeatedly():
    a = getUnknownValue()
    b = getUnknownValue()
    c = getUnknownValue()
    d = getUnknownValue()
    e = getUnknownValue()
    f = getUnknownValue()

    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
37     inst = C() 37     inst = C()
38 38
39     # This is supposed to make a call to a non-compiled function, which is 39     # This is supposed to make a call to a non-compiled function, which is
40     # being optimized separately. 40     # being optimized separately.
41 # construct_begin 41 # construct_begin
n 42     inst.compiled_method(a, b, c, d, e, f) n
43     inst.compiled_method(a, c, b, d, e, f)
44     inst.compiled_method(a, b, c, d, f, e)
45 # construct_alternative
46 42
47 43
t t 44  
45 # construct_alternative
46     pass
47 # construct_end
48 48
49 import itertools 49 import itertools
50 for x in itertools.repeat(None, 50000): 50 for x in itertools.repeat(None, 50000):
51     calledRepeatedly() 51     calledRepeatedly()
52 52

Context Diff of Generated Code


Construct
Baseline
655             goto frame_exception_exit_1; 655             goto frame_exception_exit_1;
656         } 656         }
657         assert( var_inst == NULL ); 657         assert( var_inst == NULL );
658         var_inst = tmp_assign_source_7; 658         var_inst = tmp_assign_source_7;
659     } 659     }
n 660     { n
661         PyObject *tmp_called_instance_1;
662         PyObject *tmp_call_result_1;
663         PyObject *tmp_args_element_name_1;
664         PyObject *tmp_args_element_name_2;
665         PyObject *tmp_args_element_name_3;
666         PyObject *tmp_args_element_name_4;
667         PyObject *tmp_args_element_name_5;
668         PyObject *tmp_args_element_name_6;
669         CHECK_OBJECT( var_inst );
670         tmp_called_instance_1 = var_inst;
671         CHECK_OBJECT( var_a );
672         tmp_args_element_name_1 = var_a;
673         CHECK_OBJECT( var_b );
674         tmp_args_element_name_2 = var_b;
675         CHECK_OBJECT( var_c );
676         tmp_args_element_name_3 = var_c;
677         CHECK_OBJECT( var_d );
678         tmp_args_element_name_4 = var_d;
679         CHECK_OBJECT( var_e );
680         tmp_args_element_name_5 = var_e;
681         CHECK_OBJECT( var_f );
682         tmp_args_element_name_6 = var_f;
683         frame_37d6c9b5e22939e576a3ade5c54634e1->m_frame.f_lineno = 42;
684         {
685             PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2, tmp_args_element_name_3, tmp_args_element_name_4, tmp_args_element_name_5, tmp_args_element_name_6 };
686             tmp_call_result_1 = CALL_METHOD_WITH_ARGS6( tmp_called_instance_1, const_str_plain_compiled_method, call_args );
687         }
688  
689         if ( tmp_call_result_1 == NULL )
690         {
691             assert( ERROR_OCCURRED() );
692  
693             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
694  
695  
696             exception_lineno = 42;
697             type_description_1 = "ooooooo";
698             goto frame_exception_exit_1;
699         }
700         Py_DECREF( tmp_call_result_1 );
701     }
702     {
703         PyObject *tmp_called_instance_2;
704         PyObject *tmp_call_result_2;
705         PyObject *tmp_args_element_name_7;
706         PyObject *tmp_args_element_name_8;
707         PyObject *tmp_args_element_name_9;
708         PyObject *tmp_args_element_name_10;
709         PyObject *tmp_args_element_name_11;
710         PyObject *tmp_args_element_name_12;
711         CHECK_OBJECT( var_inst );
712         tmp_called_instance_2 = var_inst;
713         CHECK_OBJECT( var_a );
714         tmp_args_element_name_7 = var_a;
715         CHECK_OBJECT( var_c );
716         tmp_args_element_name_8 = var_c;
717         CHECK_OBJECT( var_b );
718         tmp_args_element_name_9 = var_b;
719         CHECK_OBJECT( var_d );
720         tmp_args_element_name_10 = var_d;
721         CHECK_OBJECT( var_e );
722         tmp_args_element_name_11 = var_e;
723         CHECK_OBJECT( var_f );
724         tmp_args_element_name_12 = var_f;
725         frame_37d6c9b5e22939e576a3ade5c54634e1->m_frame.f_lineno = 43;
726         {
727             PyObject *call_args[] = { tmp_args_element_name_7, tmp_args_element_name_8, tmp_args_element_name_9, tmp_args_element_name_10, tmp_args_element_name_11, tmp_args_element_name_12 };
728             tmp_call_result_2 = CALL_METHOD_WITH_ARGS6( tmp_called_instance_2, const_str_plain_compiled_method, call_args );
729         }
730  
731         if ( tmp_call_result_2 == NULL )
732         {
733             assert( ERROR_OCCURRED() );
734  
735             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
736  
737  
738             exception_lineno = 43;
739             type_description_1 = "ooooooo";
740             goto frame_exception_exit_1;
741         }
742         Py_DECREF( tmp_call_result_2 );
743     }
744     {
745         PyObject *tmp_called_instance_3;
746         PyObject *tmp_call_result_3;
747         PyObject *tmp_args_element_name_13;
748         PyObject *tmp_args_element_name_14;
749         PyObject *tmp_args_element_name_15;
750         PyObject *tmp_args_element_name_16;
751         PyObject *tmp_args_element_name_17;
752         PyObject *tmp_args_element_name_18;
753         CHECK_OBJECT( var_inst );
754         tmp_called_instance_3 = var_inst;
755         CHECK_OBJECT( var_a );
756         tmp_args_element_name_13 = var_a;
757         CHECK_OBJECT( var_b );
758         tmp_args_element_name_14 = var_b;
759         CHECK_OBJECT( var_c );
760         tmp_args_element_name_15 = var_c;
761         CHECK_OBJECT( var_d );
762         tmp_args_element_name_16 = var_d;
763         CHECK_OBJECT( var_f );
764         tmp_args_element_name_17 = var_f;
765         CHECK_OBJECT( var_e );
766         tmp_args_element_name_18 = var_e;
767         frame_37d6c9b5e22939e576a3ade5c54634e1->m_frame.f_lineno = 44;
768         {
769             PyObject *call_args[] = { tmp_args_element_name_13, tmp_args_element_name_14, tmp_args_element_name_15, tmp_args_element_name_16, tmp_args_element_name_17, tmp_args_element_name_18 };
770             tmp_call_result_3 = CALL_METHOD_WITH_ARGS6( tmp_called_instance_3, const_str_plain_compiled_method, call_args );
771         }
772  
773         if ( tmp_call_result_3 == NULL )
774         {
775             assert( ERROR_OCCURRED() );
776  
777             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
778  
779  
780             exception_lineno = 44;
781             type_description_1 = "ooooooo";
782             goto frame_exception_exit_1;
783         }
784         Py_DECREF( tmp_call_result_3 );
785     }
786 660
787 #if 0 661 #if 0
788     RESTORE_FRAME_EXCEPTION( frame_37d6c9b5e22939e576a3ade5c54634e1 ); 662     RESTORE_FRAME_EXCEPTION( frame_37d6c9b5e22939e576a3ade5c54634e1 );
789 #endif 663 #endif
790 664
883     exception_keeper_lineno_1 = exception_lineno; 757     exception_keeper_lineno_1 = exception_lineno;
884     exception_type = NULL; 758     exception_type = NULL;
885     exception_value = NULL; 759     exception_value = NULL;
886     exception_tb = NULL; 760     exception_tb = NULL;
887     exception_lineno = 0; 761     exception_lineno = 0;
t 888   t
889     Py_XDECREF( var_inst );
890     var_inst = NULL;
891 762
892     Py_XDECREF( var_b ); 763     Py_XDECREF( var_b );
893     var_b = NULL; 764     var_b = NULL;
894 765
895     Py_XDECREF( var_c ); 766     Py_XDECREF( var_c );