Construct CallCompiledObjectMethodPosArgsVariable

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsVariable 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000240000000240000000260000000260000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)26138206488.11538461538461257.0CPython 2.786651299240.03846153846155422.1936614790653Nuitka (master)86652069391.96153846153845422.1929335069802Nuitka (develop)86652057543.8846153846154422.1929448519997Nuitka (factory)Construct CallCompiledObjectMethodPosArgsVariableTicks Construct CallCompiledObjectMethodPosArgsVariable 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000240000000240000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)24367365488.11538461538461257.0CPython 3.589102390240.03846153846155413.7544817703032Nuitka (master)89102861391.96153846153845413.75400411773694Nuitka (develop)89102591543.8846153846154413.75427793130996Nuitka (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
625             goto frame_exception_exit_1; 625             goto frame_exception_exit_1;
626         } 626         }
627         assert(var_inst == NULL); 627         assert(var_inst == NULL);
628         var_inst = tmp_assign_source_7; 628         var_inst = tmp_assign_source_7;
629     } 629     }
n 630     { n
631         PyObject *tmp_called_instance_1;
632         PyObject *tmp_call_result_1;
633         PyObject *tmp_args_element_name_1;
634         PyObject *tmp_args_element_name_2;
635         PyObject *tmp_args_element_name_3;
636         PyObject *tmp_args_element_name_4;
637         PyObject *tmp_args_element_name_5;
638         PyObject *tmp_args_element_name_6;
639         CHECK_OBJECT(var_inst);
640         tmp_called_instance_1 = var_inst;
641         CHECK_OBJECT(var_a);
642         tmp_args_element_name_1 = var_a;
643         CHECK_OBJECT(var_b);
644         tmp_args_element_name_2 = var_b;
645         CHECK_OBJECT(var_c);
646         tmp_args_element_name_3 = var_c;
647         CHECK_OBJECT(var_d);
648         tmp_args_element_name_4 = var_d;
649         CHECK_OBJECT(var_e);
650         tmp_args_element_name_5 = var_e;
651         CHECK_OBJECT(var_f);
652         tmp_args_element_name_6 = var_f;
653         frame_418b930b0ff0e366eb64e440695566ee->m_frame.f_lineno = 42;
654         {
655             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 };
656             tmp_call_result_1 = CALL_METHOD_WITH_ARGS6( tmp_called_instance_1, const_str_plain_compiled_method, call_args );
657         }
658  
659         if ( tmp_call_result_1 == NULL )
660         {
661             assert(ERROR_OCCURRED());
662  
663             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
664  
665  
666             exception_lineno = 42;
667             type_description_1 = "ooooooo";
668             goto frame_exception_exit_1;
669         }
670         Py_DECREF(tmp_call_result_1);
671     }
672     {
673         PyObject *tmp_called_instance_2;
674         PyObject *tmp_call_result_2;
675         PyObject *tmp_args_element_name_7;
676         PyObject *tmp_args_element_name_8;
677         PyObject *tmp_args_element_name_9;
678         PyObject *tmp_args_element_name_10;
679         PyObject *tmp_args_element_name_11;
680         PyObject *tmp_args_element_name_12;
681         CHECK_OBJECT(var_inst);
682         tmp_called_instance_2 = var_inst;
683         CHECK_OBJECT(var_a);
684         tmp_args_element_name_7 = var_a;
685         CHECK_OBJECT(var_c);
686         tmp_args_element_name_8 = var_c;
687         CHECK_OBJECT(var_b);
688         tmp_args_element_name_9 = var_b;
689         CHECK_OBJECT(var_d);
690         tmp_args_element_name_10 = var_d;
691         CHECK_OBJECT(var_e);
692         tmp_args_element_name_11 = var_e;
693         CHECK_OBJECT(var_f);
694         tmp_args_element_name_12 = var_f;
695         frame_418b930b0ff0e366eb64e440695566ee->m_frame.f_lineno = 43;
696         {
697             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 };
698             tmp_call_result_2 = CALL_METHOD_WITH_ARGS6( tmp_called_instance_2, const_str_plain_compiled_method, call_args );
699         }
700  
701         if ( tmp_call_result_2 == NULL )
702         {
703             assert(ERROR_OCCURRED());
704  
705             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
706  
707  
708             exception_lineno = 43;
709             type_description_1 = "ooooooo";
710             goto frame_exception_exit_1;
711         }
712         Py_DECREF(tmp_call_result_2);
713     }
714     {
715         PyObject *tmp_called_instance_3;
716         PyObject *tmp_call_result_3;
717         PyObject *tmp_args_element_name_13;
718         PyObject *tmp_args_element_name_14;
719         PyObject *tmp_args_element_name_15;
720         PyObject *tmp_args_element_name_16;
721         PyObject *tmp_args_element_name_17;
722         PyObject *tmp_args_element_name_18;
723         CHECK_OBJECT(var_inst);
724         tmp_called_instance_3 = var_inst;
725         CHECK_OBJECT(var_a);
726         tmp_args_element_name_13 = var_a;
727         CHECK_OBJECT(var_b);
728         tmp_args_element_name_14 = var_b;
729         CHECK_OBJECT(var_c);
730         tmp_args_element_name_15 = var_c;
731         CHECK_OBJECT(var_d);
732         tmp_args_element_name_16 = var_d;
733         CHECK_OBJECT(var_f);
734         tmp_args_element_name_17 = var_f;
735         CHECK_OBJECT(var_e);
736         tmp_args_element_name_18 = var_e;
737         frame_418b930b0ff0e366eb64e440695566ee->m_frame.f_lineno = 44;
738         {
739             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 };
740             tmp_call_result_3 = CALL_METHOD_WITH_ARGS6( tmp_called_instance_3, const_str_plain_compiled_method, call_args );
741         }
742  
743         if ( tmp_call_result_3 == NULL )
744         {
745             assert(ERROR_OCCURRED());
746  
747             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
748  
749  
750             exception_lineno = 44;
751             type_description_1 = "ooooooo";
752             goto frame_exception_exit_1;
753         }
754         Py_DECREF(tmp_call_result_3);
755     }
756 630
757 #if 0 631 #if 0
758     RESTORE_FRAME_EXCEPTION(frame_418b930b0ff0e366eb64e440695566ee); 632     RESTORE_FRAME_EXCEPTION(frame_418b930b0ff0e366eb64e440695566ee);
759 #endif 633 #endif
760 634
850     exception_keeper_lineno_1 = exception_lineno; 724     exception_keeper_lineno_1 = exception_lineno;
851     exception_type = NULL; 725     exception_type = NULL;
852     exception_value = NULL; 726     exception_value = NULL;
853     exception_tb = NULL; 727     exception_tb = NULL;
854     exception_lineno = 0; 728     exception_lineno = 0;
t 855   t
856     Py_XDECREF(var_inst);
857     var_inst = NULL;
858 729
859     Py_XDECREF(var_b); 730     Py_XDECREF(var_b);
860     var_b = NULL; 731     var_b = NULL;
861 732
862     Py_XDECREF(var_c); 733     Py_XDECREF(var_c);