Construct BuiltinSumWithList

Performance Diagrams

Construct BuiltinSumWithList 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1583120288.95192307692307257.0CPython 2.713350006242.31730769230768295.72995264959377Nuitka (master)13350779395.6826923076923295.717886592177Nuitka (develop)13350745549.0480769230769295.7184173113907Nuitka (factory)Construct BuiltinSumWithListTicks Construct BuiltinSumWithList 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000260000002600000028000000280000003000000030000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3169637888.95192307692307257.0CPython 3.525700929242.31730769230768303.7424916997432Nuitka (master)25696318395.6826923076923303.7784405718339Nuitka (develop)25701269549.0480769230769303.7398409479516Nuitka (factory)Construct BuiltinSumWithListTicks

Source Code with Construct

empty = ()

value = list(range(10))

def calledRepeatedly():
    # We measure making a generator iterator step or not.
    x = value

    # This should abort.
# construct_begin
    y = sum(x)
# construct_alternative



    return x, y

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

empty = ()

value = list(range(10))

def calledRepeatedly():
    # We measure making a generator iterator step or not.
    x = value

    # This should abort.
# construct_begin

# construct_alternative
    y = sum(empty)
# construct_end

    return x, y

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
26     # We measure making a generator iterator step or not. 26     # We measure making a generator iterator step or not.
27     x = value 27     x = value
28 28
29     # This should abort. 29     # This should abort.
30 # construct_begin 30 # construct_begin
n 31     y = sum(x) n 31  
32 # construct_alternative 32 # construct_alternative
t 33   t 33     y = sum(empty)
34   34 # construct_end
35 35
36     return x, y 36     return x, y
37 37
38 import itertools 38 import itertools
39 for x in itertools.repeat(None, 50000): 39 for x in itertools.repeat(None, 50000):

Context Diff of Generated Code


Construct
Baseline
70 static bool constants_created = false; 70 static bool constants_created = false;
71 71
72 /* Function to create module private constants. */ 72 /* Function to create module private constants. */
73 static void createModuleConstants( void ) 73 static void createModuleConstants( void )
74 { 74 {
n 75     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 65 ], 9, 1); n 75     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 92 ], 9, 1);
76     const_str_plain_False = UNSTREAM_STRING_ASCII(&constant_bin[ 74 ], 5, 1); 76     const_str_plain_False = UNSTREAM_STRING_ASCII(&constant_bin[ 101 ], 5, 1);
77     const_str_plain_y = UNSTREAM_STRING_ASCII(&constant_bin[ 48 ], 1, 1); 77     const_str_plain_y = UNSTREAM_STRING_ASCII(&constant_bin[ 37 ], 1, 1);
78     const_int_pos_9 = PyLong_FromUnsignedLong(9ul); 78     const_int_pos_9 = PyLong_FromUnsignedLong(9ul);
n 79     const_str_digest_a6e80e142833df723056b6711bd59f95 = UNSTREAM_STRING_ASCII(&constant_bin[ 79 ], 43, 0); n 79     const_str_digest_a6e80e142833df723056b6711bd59f95 = UNSTREAM_STRING_ASCII(&constant_bin[ 106 ], 43, 0);
80     const_str_plain_value = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 5, 1); 80     const_str_plain_value = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 5, 1);
n 81     const_str_plain_empty = UNSTREAM_STRING_ASCII(&constant_bin[ 122 ], 5, 1); n 81     const_str_plain_empty = UNSTREAM_STRING_ASCII(&constant_bin[ 33 ], 5, 1);
82     const_int_pos_3 = PyLong_FromUnsignedLong(3ul); 82     const_int_pos_3 = PyLong_FromUnsignedLong(3ul);
83     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul); 83     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul);
84     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1); 84     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1);
n 85     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 127 ], 3, 0); n 85     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 149 ], 3, 0);
86     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352); 86     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352);
n 87     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII(&constant_bin[ 33 ], 16, 1); n 87     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII(&constant_bin[ 60 ], 16, 1);
88     const_tuple_str_plain_y_str_plain_x_tuple = PyTuple_New(2); 88     const_tuple_str_plain_y_str_plain_x_tuple = PyTuple_New(2);
89     PyTuple_SET_ITEM(const_tuple_str_plain_y_str_plain_x_tuple, 0, const_str_plain_y); Py_INCREF(const_str_plain_y); 89     PyTuple_SET_ITEM(const_tuple_str_plain_y_str_plain_x_tuple, 0, const_str_plain_y); Py_INCREF(const_str_plain_y);
n 90     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 130 ], 1, 1); n 90     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 152 ], 1, 1);
91     PyTuple_SET_ITEM(const_tuple_str_plain_y_str_plain_x_tuple, 1, const_str_plain_x); Py_INCREF(const_str_plain_x); 91     PyTuple_SET_ITEM(const_tuple_str_plain_y_str_plain_x_tuple, 1, const_str_plain_x); Py_INCREF(const_str_plain_x);
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[ 131 ], 8, 0); n 93     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 153 ], 8, 0);
94     const_int_pos_6 = PyLong_FromUnsignedLong(6ul); 94     const_int_pos_6 = PyLong_FromUnsignedLong(6ul);
95     const_int_pos_7 = PyLong_FromUnsignedLong(7ul); 95     const_int_pos_7 = PyLong_FromUnsignedLong(7ul);
n 96     const_str_plain_None = UNSTREAM_STRING_ASCII(&constant_bin[ 139 ], 4, 1); n 96     const_str_plain_None = UNSTREAM_STRING_ASCII(&constant_bin[ 161 ], 4, 1);
97     const_list_fe06ae4170d4fead2c958439c738859e_list = PyList_New(10); 97     const_list_fe06ae4170d4fead2c958439c738859e_list = PyList_New(10);
98     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 0, const_int_0); Py_INCREF(const_int_0); 98     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 0, const_int_0); Py_INCREF(const_int_0);
99     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 1, const_int_pos_1); Py_INCREF(const_int_pos_1); 99     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 1, const_int_pos_1); Py_INCREF(const_int_pos_1);
100     const_int_pos_2 = PyLong_FromUnsignedLong(2ul); 100     const_int_pos_2 = PyLong_FromUnsignedLong(2ul);
101     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 2, const_int_pos_2); Py_INCREF(const_int_pos_2); 101     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 2, const_int_pos_2); Py_INCREF(const_int_pos_2);
106     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 5, const_int_pos_5); Py_INCREF(const_int_pos_5); 106     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 5, const_int_pos_5); Py_INCREF(const_int_pos_5);
107     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 6, const_int_pos_6); Py_INCREF(const_int_pos_6); 107     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 6, const_int_pos_6); Py_INCREF(const_int_pos_6);
108     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 7, const_int_pos_7); Py_INCREF(const_int_pos_7); 108     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 7, const_int_pos_7); Py_INCREF(const_int_pos_7);
109     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 8, const_int_pos_8); Py_INCREF(const_int_pos_8); 109     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 8, const_int_pos_8); Py_INCREF(const_int_pos_8);
110     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 9, const_int_pos_9); Py_INCREF(const_int_pos_9); 110     PyList_SET_ITEM(const_list_fe06ae4170d4fead2c958439c738859e_list, 9, const_int_pos_9); Py_INCREF(const_int_pos_9);
n 111     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 143 ], 6, 1); n 111     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 165 ], 6, 1);
112     const_tuple_none_int_pos_50000_tuple = PyTuple_New(2); 112     const_tuple_none_int_pos_50000_tuple = PyTuple_New(2);
113     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 0, Py_None); Py_INCREF(Py_None); 113     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 0, Py_None); Py_INCREF(Py_None);
114     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000); Py_INCREF(const_int_pos_50000); 114     PyTuple_SET_ITEM(const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000); Py_INCREF(const_int_pos_50000);
n 115     const_str_plain___debug__ = UNSTREAM_STRING_ASCII(&constant_bin[ 149 ], 9, 1); n 115     const_str_plain___debug__ = UNSTREAM_STRING_ASCII(&constant_bin[ 171 ], 9, 1);
116 116
117     constants_created = true; 117     constants_created = true;
118 } 118 }
119 119
120 /* Function to verify module private constants for non-corruption. */ 120 /* Function to verify module private constants for non-corruption. */
209         var_x = tmp_assign_source_1; 209         var_x = tmp_assign_source_1;
210     } 210     }
211     { 211     {
212         PyObject *tmp_assign_source_2; 212         PyObject *tmp_assign_source_2;
213         PyObject *tmp_sum_sequence_1; 213         PyObject *tmp_sum_sequence_1;
n 214         CHECK_OBJECT(var_x); n 214         PyObject *tmp_mvar_value_2;
215         tmp_mvar_value_2 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_empty);
216  
217         if (unlikely(tmp_mvar_value_2 == NULL)) {
218             tmp_mvar_value_2 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_empty);
219         }
220  
221         if (tmp_mvar_value_2 == NULL) {
222  
223             exception_type = PyExc_NameError;
224             Py_INCREF(exception_type);
225             exception_value = UNSTREAM_STRING(&constant_bin[ 27 ], 27, 0);
226             exception_tb = NULL;
227             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
228             CHAIN_EXCEPTION(exception_value);
229  
230             exception_lineno = 33;
231             type_description_1 = "oo";
232             goto frame_exception_exit_1;
233         }
234  
215         tmp_sum_sequence_1 = var_x; 235         tmp_sum_sequence_1 = tmp_mvar_value_2;
216         tmp_assign_source_2 = BUILTIN_SUM1(tmp_sum_sequence_1); 236         tmp_assign_source_2 = BUILTIN_SUM1(tmp_sum_sequence_1);
217         if (tmp_assign_source_2 == NULL) { 237         if (tmp_assign_source_2 == NULL) {
218             assert(ERROR_OCCURRED()); 238             assert(ERROR_OCCURRED());
219 239
220             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 240             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
221 241
222 242
n 223             exception_lineno = 31; n 243             exception_lineno = 33;
224             type_description_1 = "oo"; 244             type_description_1 = "oo";
225             goto frame_exception_exit_1; 245             goto frame_exception_exit_1;
226         } 246         }
227         assert(var_y == NULL); 247         assert(var_y == NULL);
228         var_y = tmp_assign_source_2; 248         var_y = tmp_assign_source_2;
802 822
803         if (tmp_mvar_value_2 == NULL) { 823         if (tmp_mvar_value_2 == NULL) {
804 824
805             exception_type = PyExc_NameError; 825             exception_type = PyExc_NameError;
806             Py_INCREF(exception_type); 826             Py_INCREF(exception_type);
t 807             exception_value = UNSTREAM_STRING(&constant_bin[ 27 ], 38, 0); t 827             exception_value = UNSTREAM_STRING(&constant_bin[ 54 ], 38, 0);
808             exception_tb = NULL; 828             exception_tb = NULL;
809             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb); 829             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
810             CHAIN_EXCEPTION(exception_value); 830             CHAIN_EXCEPTION(exception_value);
811 831
812             exception_lineno = 40; 832             exception_lineno = 40;