Construct CallCompiledFunctionPosArgsVariable

Performance Diagrams

Construct CallCompiledFunctionPosArgsVariable 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)22715685088.11538461538461257.0CPython 2.758550006240.03846153846155440.42103750710646Nuitka (master)58550012391.96153846153845440.42103097993237Nuitka (develop)58550034543.8846153846154440.42100704696065Nuitka (factory)Construct CallCompiledFunctionPosArgsVariableTicks Construct CallCompiledFunctionPosArgsVariable 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)21126005088.11538461538461257.0CPython 3.567799938240.03846153846155424.8083516208869Nuitka (master)67800570391.96153846153845424.8076123570125Nuitka (develop)67800762543.8846153846154424.807387770519Nuitka (factory)Construct CallCompiledFunctionPosArgsVariableTicks

Source Code with Construct

from __future__ import print_function

def compiled_func(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()

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

def compiled_func(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()

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

Context Diff of Generated Code


Construct
Baseline
66 static bool constants_created = false; 66 static bool constants_created = false;
67 67
68 /* Function to create module private constants. */ 68 /* Function to create module private constants. */
69 static void createModuleConstants( void ) 69 static void createModuleConstants( void )
70 { 70 {
n 71     const_str_plain_b = UNSTREAM_STRING_ASCII(&constant_bin[ 110 ], 1, 1); n 71     const_str_plain_b = UNSTREAM_STRING_ASCII(&constant_bin[ 75 ], 1, 1);
72     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 111 ], 9, 1); 72     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 76 ], 9, 1);
73     const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple = PyTuple_New(6); 73     const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple = PyTuple_New(6);
74     const_str_plain_a = UNSTREAM_STRING_ASCII(&constant_bin[ 1 ], 1, 1); 74     const_str_plain_a = UNSTREAM_STRING_ASCII(&constant_bin[ 1 ], 1, 1);
75     PyTuple_SET_ITEM(const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple, 0, const_str_plain_a); Py_INCREF(const_str_plain_a); 75     PyTuple_SET_ITEM(const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple, 0, const_str_plain_a); Py_INCREF(const_str_plain_a);
76     PyTuple_SET_ITEM(const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple, 1, const_str_plain_b); Py_INCREF(const_str_plain_b); 76     PyTuple_SET_ITEM(const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple, 1, const_str_plain_b); Py_INCREF(const_str_plain_b);
77     const_str_plain_c = UNSTREAM_STRING_ASCII(&constant_bin[ 43 ], 1, 1); 77     const_str_plain_c = UNSTREAM_STRING_ASCII(&constant_bin[ 43 ], 1, 1);
80     PyTuple_SET_ITEM(const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple, 3, const_str_plain_d); Py_INCREF(const_str_plain_d); 80     PyTuple_SET_ITEM(const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple, 3, const_str_plain_d); Py_INCREF(const_str_plain_d);
81     const_str_plain_e = UNSTREAM_STRING_ASCII(&constant_bin[ 3 ], 1, 1); 81     const_str_plain_e = UNSTREAM_STRING_ASCII(&constant_bin[ 3 ], 1, 1);
82     PyTuple_SET_ITEM(const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple, 4, const_str_plain_e); Py_INCREF(const_str_plain_e); 82     PyTuple_SET_ITEM(const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple, 4, const_str_plain_e); Py_INCREF(const_str_plain_e);
83     const_str_plain_f = UNSTREAM_STRING_ASCII(&constant_bin[ 32 ], 1, 1); 83     const_str_plain_f = UNSTREAM_STRING_ASCII(&constant_bin[ 32 ], 1, 1);
84     PyTuple_SET_ITEM(const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple, 5, const_str_plain_f); Py_INCREF(const_str_plain_f); 84     PyTuple_SET_ITEM(const_tuple_d4571c3ff966778a8b3ba4a6bd66fdef_tuple, 5, const_str_plain_f); Py_INCREF(const_str_plain_f);
n 85     const_str_plain_compiled_func = UNSTREAM_STRING_ASCII(&constant_bin[ 43 ], 13, 1); n 85     const_str_plain_compiled_func = UNSTREAM_STRING_ASCII(&constant_bin[ 85 ], 13, 1);
86     const_str_digest_ddaf7907b1c9362a4da58b48fe425b63 = UNSTREAM_STRING_ASCII(&constant_bin[ 120 ], 60, 0); 86     const_str_digest_ddaf7907b1c9362a4da58b48fe425b63 = UNSTREAM_STRING_ASCII(&constant_bin[ 98 ], 60, 0);
87     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul); 87     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul);
88     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1); 88     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1);
n 89     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 180 ], 3, 0); n 89     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 158 ], 3, 0);
90     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352); 90     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352);
n 91     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII(&constant_bin[ 78 ], 16, 1); n 91     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII(&constant_bin[ 43 ], 16, 1);
92     const_int_pos_8 = PyLong_FromUnsignedLong(8ul); 92     const_int_pos_8 = PyLong_FromUnsignedLong(8ul);
n 93     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 183 ], 8, 0); n 93     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 161 ], 8, 0);
94     const_str_plain_None = UNSTREAM_STRING_ASCII(&constant_bin[ 191 ], 4, 1); 94     const_str_plain_None = UNSTREAM_STRING_ASCII(&constant_bin[ 169 ], 4, 1);
95     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 195 ], 1, 1); 95     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 173 ], 1, 1);
96     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 196 ], 6, 1); 96     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 174 ], 6, 1);
97     const_tuple_none_int_pos_50000_tuple = PyTuple_New(2); 97     const_tuple_none_int_pos_50000_tuple = PyTuple_New(2);
98     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 0, Py_None); Py_INCREF(Py_None); 98     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 0, Py_None); Py_INCREF(Py_None);
99     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000); Py_INCREF(const_int_pos_50000); 99     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000); Py_INCREF(const_int_pos_50000);
100     const_tuple_55466054951980d6b25c1e8547da8eed_tuple = PyTuple_New(6); 100     const_tuple_55466054951980d6b25c1e8547da8eed_tuple = PyTuple_New(6);
101     PyTuple_SET_ITEM(const_tuple_55466054951980d6b25c1e8547da8eed_tuple, 0, const_str_plain_b); Py_INCREF(const_str_plain_b); 101     PyTuple_SET_ITEM(const_tuple_55466054951980d6b25c1e8547da8eed_tuple, 0, const_str_plain_b); Py_INCREF(const_str_plain_b);
103     PyTuple_SET_ITEM(const_tuple_55466054951980d6b25c1e8547da8eed_tuple, 2, const_str_plain_e); Py_INCREF(const_str_plain_e); 103     PyTuple_SET_ITEM(const_tuple_55466054951980d6b25c1e8547da8eed_tuple, 2, const_str_plain_e); Py_INCREF(const_str_plain_e);
104     PyTuple_SET_ITEM(const_tuple_55466054951980d6b25c1e8547da8eed_tuple, 3, const_str_plain_a); Py_INCREF(const_str_plain_a); 104     PyTuple_SET_ITEM(const_tuple_55466054951980d6b25c1e8547da8eed_tuple, 3, const_str_plain_a); Py_INCREF(const_str_plain_a);
105     PyTuple_SET_ITEM(const_tuple_55466054951980d6b25c1e8547da8eed_tuple, 4, const_str_plain_f); Py_INCREF(const_str_plain_f); 105     PyTuple_SET_ITEM(const_tuple_55466054951980d6b25c1e8547da8eed_tuple, 4, const_str_plain_f); Py_INCREF(const_str_plain_f);
106     PyTuple_SET_ITEM(const_tuple_55466054951980d6b25c1e8547da8eed_tuple, 5, const_str_plain_d); Py_INCREF(const_str_plain_d); 106     PyTuple_SET_ITEM(const_tuple_55466054951980d6b25c1e8547da8eed_tuple, 5, const_str_plain_d); Py_INCREF(const_str_plain_d);
107     const_str_plain_getUnknownValue = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 15, 1); 107     const_str_plain_getUnknownValue = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 15, 1);
n 108     const_str_plain_print_function = UNSTREAM_STRING_ASCII(&constant_bin[ 202 ], 14, 1); n 108     const_str_plain_print_function = UNSTREAM_STRING_ASCII(&constant_bin[ 180 ], 14, 1);
109 109
110     constants_created = true; 110     constants_created = true;
111 } 111 }
112 112
113 /* Function to verify module private constants for non-corruption. */ 113 /* Function to verify module private constants for non-corruption. */
530             goto frame_exception_exit_1; 530             goto frame_exception_exit_1;
531         } 531         }
532         assert(var_f == NULL); 532         assert(var_f == NULL);
533         var_f = tmp_assign_source_6; 533         var_f = tmp_assign_source_6;
534     } 534     }
n 535     { n
536         PyObject *tmp_called_name_7;
537         PyObject *tmp_mvar_value_7;
538         PyObject *tmp_call_result_1;
539         PyObject *tmp_args_element_name_1;
540         PyObject *tmp_args_element_name_2;
541         PyObject *tmp_args_element_name_3;
542         PyObject *tmp_args_element_name_4;
543         PyObject *tmp_args_element_name_5;
544         PyObject *tmp_args_element_name_6;
545         tmp_mvar_value_7 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func);
546  
547         if (unlikely(tmp_mvar_value_7 == NULL)) {
548             tmp_mvar_value_7 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func);
549         }
550  
551         if (tmp_mvar_value_7 == NULL) {
552  
553             exception_type = PyExc_NameError;
554             Py_INCREF(exception_type);
555             exception_value = UNSTREAM_STRING(&constant_bin[ 37 ], 35, 0);
556             exception_tb = NULL;
557             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
558             CHAIN_EXCEPTION(exception_value);
559  
560             exception_lineno = 39;
561             type_description_1 = "oooooo";
562             goto frame_exception_exit_1;
563         }
564  
565         tmp_called_name_7 = tmp_mvar_value_7;
566         CHECK_OBJECT(var_a);
567         tmp_args_element_name_1 = var_a;
568         CHECK_OBJECT(var_b);
569         tmp_args_element_name_2 = var_b;
570         CHECK_OBJECT(var_c);
571         tmp_args_element_name_3 = var_c;
572         CHECK_OBJECT(var_d);
573         tmp_args_element_name_4 = var_d;
574         CHECK_OBJECT(var_e);
575         tmp_args_element_name_5 = var_e;
576         CHECK_OBJECT(var_f);
577         tmp_args_element_name_6 = var_f;
578         frame_4b8ea50e070a0759d42070bf121390f9->m_frame.f_lineno = 39;
579         {
580             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 };
581             tmp_call_result_1 = CALL_FUNCTION_WITH_ARGS6(tmp_called_name_7, call_args);
582         }
583  
584         if (tmp_call_result_1 == NULL) {
585             assert(ERROR_OCCURRED());
586  
587             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
588  
589  
590             exception_lineno = 39;
591             type_description_1 = "oooooo";
592             goto frame_exception_exit_1;
593         }
594         Py_DECREF(tmp_call_result_1);
595     }
596     {
597         PyObject *tmp_called_name_8;
598         PyObject *tmp_mvar_value_8;
599         PyObject *tmp_call_result_2;
600         PyObject *tmp_args_element_name_7;
601         PyObject *tmp_args_element_name_8;
602         PyObject *tmp_args_element_name_9;
603         PyObject *tmp_args_element_name_10;
604         PyObject *tmp_args_element_name_11;
605         PyObject *tmp_args_element_name_12;
606         tmp_mvar_value_8 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func);
607  
608         if (unlikely(tmp_mvar_value_8 == NULL)) {
609             tmp_mvar_value_8 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func);
610         }
611  
612         if (tmp_mvar_value_8 == NULL) {
613  
614             exception_type = PyExc_NameError;
615             Py_INCREF(exception_type);
616             exception_value = UNSTREAM_STRING(&constant_bin[ 37 ], 35, 0);
617             exception_tb = NULL;
618             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
619             CHAIN_EXCEPTION(exception_value);
620  
621             exception_lineno = 40;
622             type_description_1 = "oooooo";
623             goto frame_exception_exit_1;
624         }
625  
626         tmp_called_name_8 = tmp_mvar_value_8;
627         CHECK_OBJECT(var_a);
628         tmp_args_element_name_7 = var_a;
629         CHECK_OBJECT(var_c);
630         tmp_args_element_name_8 = var_c;
631         CHECK_OBJECT(var_b);
632         tmp_args_element_name_9 = var_b;
633         CHECK_OBJECT(var_d);
634         tmp_args_element_name_10 = var_d;
635         CHECK_OBJECT(var_e);
636         tmp_args_element_name_11 = var_e;
637         CHECK_OBJECT(var_f);
638         tmp_args_element_name_12 = var_f;
639         frame_4b8ea50e070a0759d42070bf121390f9->m_frame.f_lineno = 40;
640         {
641             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 };
642             tmp_call_result_2 = CALL_FUNCTION_WITH_ARGS6(tmp_called_name_8, call_args);
643         }
644  
645         if (tmp_call_result_2 == NULL) {
646             assert(ERROR_OCCURRED());
647  
648             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
649  
650  
651             exception_lineno = 40;
652             type_description_1 = "oooooo";
653             goto frame_exception_exit_1;
654         }
655         Py_DECREF(tmp_call_result_2);
656     }
657     {
658         PyObject *tmp_called_name_9;
659         PyObject *tmp_mvar_value_9;
660         PyObject *tmp_call_result_3;
661         PyObject *tmp_args_element_name_13;
662         PyObject *tmp_args_element_name_14;
663         PyObject *tmp_args_element_name_15;
664         PyObject *tmp_args_element_name_16;
665         PyObject *tmp_args_element_name_17;
666         PyObject *tmp_args_element_name_18;
667         tmp_mvar_value_9 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func);
668  
669         if (unlikely(tmp_mvar_value_9 == NULL)) {
670             tmp_mvar_value_9 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func);
671         }
672  
673         if (tmp_mvar_value_9 == NULL) {
674  
675             exception_type = PyExc_NameError;
676             Py_INCREF(exception_type);
677             exception_value = UNSTREAM_STRING(&constant_bin[ 37 ], 35, 0);
678             exception_tb = NULL;
679             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
680             CHAIN_EXCEPTION(exception_value);
681  
682             exception_lineno = 41;
683             type_description_1 = "oooooo";
684             goto frame_exception_exit_1;
685         }
686  
687         tmp_called_name_9 = tmp_mvar_value_9;
688         CHECK_OBJECT(var_a);
689         tmp_args_element_name_13 = var_a;
690         CHECK_OBJECT(var_b);
691         tmp_args_element_name_14 = var_b;
692         CHECK_OBJECT(var_c);
693         tmp_args_element_name_15 = var_c;
694         CHECK_OBJECT(var_d);
695         tmp_args_element_name_16 = var_d;
696         CHECK_OBJECT(var_f);
697         tmp_args_element_name_17 = var_f;
698         CHECK_OBJECT(var_e);
699         tmp_args_element_name_18 = var_e;
700         frame_4b8ea50e070a0759d42070bf121390f9->m_frame.f_lineno = 41;
701         {
702             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 };
703             tmp_call_result_3 = CALL_FUNCTION_WITH_ARGS6(tmp_called_name_9, call_args);
704         }
705  
706         if (tmp_call_result_3 == NULL) {
707             assert(ERROR_OCCURRED());
708  
709             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
710  
711  
712             exception_lineno = 41;
713             type_description_1 = "oooooo";
714             goto frame_exception_exit_1;
715         }
716         Py_DECREF(tmp_call_result_3);
717     }
718 535
719 #if 0 536 #if 0
720     RESTORE_FRAME_EXCEPTION(frame_4b8ea50e070a0759d42070bf121390f9); 537     RESTORE_FRAME_EXCEPTION(frame_4b8ea50e070a0759d42070bf121390f9);
721 #endif 538 #endif
722 539
819     Py_XDECREF(var_e); 636     Py_XDECREF(var_e);
820     var_e = NULL; 637     var_e = NULL;
821 638
822     Py_XDECREF(var_a); 639     Py_XDECREF(var_a);
823     var_a = NULL; 640     var_a = NULL;
n 824   n
825     Py_XDECREF(var_f);
826     var_f = NULL;
827 641
828     Py_XDECREF(var_d); 642     Py_XDECREF(var_d);
829     var_d = NULL; 643     var_d = NULL;
830 644
831     // Re-raise. 645     // Re-raise.
1387 1201
1388         if (tmp_mvar_value_2 == NULL) { 1202         if (tmp_mvar_value_2 == NULL) {
1389 1203
1390             exception_type = PyExc_NameError; 1204             exception_type = PyExc_NameError;
1391             Py_INCREF(exception_type); 1205             Py_INCREF(exception_type);
t 1392             exception_value = UNSTREAM_STRING(&constant_bin[ 72 ], 38, 0); t 1206             exception_value = UNSTREAM_STRING(&constant_bin[ 37 ], 38, 0);
1393             exception_tb = NULL; 1207             exception_tb = NULL;
1394             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb); 1208             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
1395             CHAIN_EXCEPTION(exception_value); 1209             CHAIN_EXCEPTION(exception_value);
1396 1210
1397             exception_lineno = 48; 1211             exception_lineno = 48;