Construct InplaceOperationListAdd

Performance Diagrams

Construct InplaceOperationListAdd 0040000004000000800000080000001200000012000000160000001600000020000000200000002400000024000000280000002800000032000000320000003600000036000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)3630692288.95192307692307257.0CPython 2.719652467242.31730769230768370.35502505237474Nuitka (master)19652461395.6826923076923370.35506589010555Nuitka (develop)19653307549.0480769230769370.34930777005934Nuitka (factory)Construct InplaceOperationListAddTicks Construct InplaceOperationListAdd 004000000400000080000008000000120000001200000016000000160000002000000020000000240000002400000028000000280000003200000032000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3417779388.95192307692307257.0CPython 3.521050385242.31730769230768351.91497818256073Nuitka (master)21050440395.6826923076923351.914580516563Nuitka (develop)21040277549.0480769230769351.9880619626542Nuitka (factory)Construct InplaceOperationListAddTicks

Source Code with Construct

module_value1 = [5.0]
module_value2 = [3.0]

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    # Make sure we have a local variable s anyway
    s = [2.0]

    local_value = module_value1

    s += module_value1
# construct_begin
    s += [1000.0]
# construct_end
    s += module_value2

    return s

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

print("OK.")

Source Code without Construct

module_value1 = [5.0]
module_value2 = [3.0]

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    # Make sure we have a local variable s anyway
    s = [2.0]

    local_value = module_value1

    s += module_value1
# construct_begin


    s += module_value2

    return s

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

print("OK.")

Context Diff of Source Code


Construct
Baseline
30 30
31     local_value = module_value1 31     local_value = module_value1
32 32
33     s += module_value1 33     s += module_value1
34 # construct_begin 34 # construct_begin
t 35     s += [1000.0] t 35  
36 # construct_end 36  
37     s += module_value2 37     s += module_value2
38 38
39     return s 39     return s
40 40
41 import itertools 41 import itertools

Context Diff of Generated Code


Construct
Baseline
32 32
33 /* The declarations of module constants used, if any. */ 33 /* The declarations of module constants used, if any. */
34 static PyObject *const_str_plain_itertools; 34 static PyObject *const_str_plain_itertools;
35 static PyObject *const_str_plain_s; 35 static PyObject *const_str_plain_s;
36 static PyObject *const_list_float_3_0_list; 36 static PyObject *const_list_float_3_0_list;
n 37 static PyObject *const_list_float_1000_0_list; n
38 extern PyObject *const_str_plain___file__; 37 extern PyObject *const_str_plain___file__;
39 static PyObject *const_float_5_0; 38 static PyObject *const_float_5_0;
40 static PyObject *const_str_digest_7e33e3b841bef83cf3a811024fef9b5c; 39 static PyObject *const_str_digest_7e33e3b841bef83cf3a811024fef9b5c;
41 static PyObject *const_list_float_5_0_list; 40 static PyObject *const_list_float_5_0_list;
42 extern PyObject *const_int_0; 41 extern PyObject *const_int_0;
48 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 47 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
49 static PyObject *const_str_plain_module_value1; 48 static PyObject *const_str_plain_module_value1;
50 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 49 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
51 static PyObject *const_str_plain_calledRepeatedly; 50 static PyObject *const_str_plain_calledRepeatedly;
52 static PyObject *const_list_float_2_0_list; 51 static PyObject *const_list_float_2_0_list;
n 53 static PyObject *const_float_1000_0; n
54 static PyObject *const_str_angle_module; 52 static PyObject *const_str_angle_module;
55 static PyObject *const_str_plain_None; 53 static PyObject *const_str_plain_None;
56 static PyObject *const_str_plain_x; 54 static PyObject *const_str_plain_x;
57 extern PyObject *const_tuple_empty; 55 extern PyObject *const_tuple_empty;
58 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 56 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
72     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 108 ], 9, 1); 70     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 108 ], 9, 1);
73     const_str_plain_s = UNSTREAM_STRING_ASCII(&constant_bin[ 22 ], 1, 1); 71     const_str_plain_s = UNSTREAM_STRING_ASCII(&constant_bin[ 22 ], 1, 1);
74     const_list_float_3_0_list = PyList_New(1); 72     const_list_float_3_0_list = PyList_New(1);
75     const_float_3_0 = UNSTREAM_FLOAT(&constant_bin[ 117 ]); 73     const_float_3_0 = UNSTREAM_FLOAT(&constant_bin[ 117 ]);
76     PyList_SET_ITEM(const_list_float_3_0_list, 0, const_float_3_0); Py_INCREF(const_float_3_0); 74     PyList_SET_ITEM(const_list_float_3_0_list, 0, const_float_3_0); Py_INCREF(const_float_3_0);
n 77     const_list_float_1000_0_list = PyList_New(1); n
78     const_float_1000_0 = UNSTREAM_FLOAT(&constant_bin[ 125 ]);
79     PyList_SET_ITEM(const_list_float_1000_0_list, 0, const_float_1000_0); Py_INCREF(const_float_1000_0);
80     const_float_5_0 = UNSTREAM_FLOAT(&constant_bin[ 133 ]); 75     const_float_5_0 = UNSTREAM_FLOAT(&constant_bin[ 125 ]);
81     const_str_digest_7e33e3b841bef83cf3a811024fef9b5c = UNSTREAM_STRING_ASCII(&constant_bin[ 141 ], 48, 0); 76     const_str_digest_7e33e3b841bef83cf3a811024fef9b5c = UNSTREAM_STRING_ASCII(&constant_bin[ 133 ], 48, 0);
82     const_list_float_5_0_list = PyList_New(1); 77     const_list_float_5_0_list = PyList_New(1);
83     PyList_SET_ITEM(const_list_float_5_0_list, 0, const_float_5_0); Py_INCREF(const_float_5_0); 78     PyList_SET_ITEM(const_list_float_5_0_list, 0, const_float_5_0); Py_INCREF(const_float_5_0);
n 84     const_float_2_0 = UNSTREAM_FLOAT(&constant_bin[ 189 ]); n 79     const_float_2_0 = UNSTREAM_FLOAT(&constant_bin[ 181 ]);
85     const_str_plain_local_value = UNSTREAM_STRING_ASCII(&constant_bin[ 197 ], 11, 1); 80     const_str_plain_local_value = UNSTREAM_STRING_ASCII(&constant_bin[ 189 ], 11, 1);
86     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul); 81     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul);
87     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII(&constant_bin[ 41 ], 13, 1); 82     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII(&constant_bin[ 41 ], 13, 1);
88     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1); 83     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1);
n 89     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 208 ], 3, 0); n 84     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 200 ], 3, 0);
90     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352); 85     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352);
91     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 13, 1); 86     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 13, 1);
92     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New(2); 87     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New(2);
93     PyTuple_SET_ITEM(const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s); Py_INCREF(const_str_plain_s); 88     PyTuple_SET_ITEM(const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s); Py_INCREF(const_str_plain_s);
94     PyTuple_SET_ITEM(const_tuple_str_plain_s_str_plain_local_value_tuple, 1, const_str_plain_local_value); Py_INCREF(const_str_plain_local_value); 89     PyTuple_SET_ITEM(const_tuple_str_plain_s_str_plain_local_value_tuple, 1, const_str_plain_local_value); Py_INCREF(const_str_plain_local_value);
95     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII(&constant_bin[ 76 ], 16, 1); 90     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII(&constant_bin[ 76 ], 16, 1);
96     const_list_float_2_0_list = PyList_New(1); 91     const_list_float_2_0_list = PyList_New(1);
97     PyList_SET_ITEM(const_list_float_2_0_list, 0, const_float_2_0); Py_INCREF(const_float_2_0); 92     PyList_SET_ITEM(const_list_float_2_0_list, 0, const_float_2_0); Py_INCREF(const_float_2_0);
n 98     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 211 ], 8, 0); n 93     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 203 ], 8, 0);
99     const_str_plain_None = UNSTREAM_STRING_ASCII(&constant_bin[ 219 ], 4, 1); 94     const_str_plain_None = UNSTREAM_STRING_ASCII(&constant_bin[ 211 ], 4, 1);
100     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 223 ], 1, 1); 95     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 215 ], 1, 1);
101     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 224 ], 6, 1); 96     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 216 ], 6, 1);
102     const_tuple_none_int_pos_50000_tuple = PyTuple_New(2); 97     const_tuple_none_int_pos_50000_tuple = PyTuple_New(2);
103     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);
104     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);
105 100
106     constants_created = true; 101     constants_created = true;
272     } 267     }
273     { 268     {
274         PyObject *tmp_assign_source_4; 269         PyObject *tmp_assign_source_4;
275         PyObject *tmp_left_name_2; 270         PyObject *tmp_left_name_2;
276         PyObject *tmp_right_name_2; 271         PyObject *tmp_right_name_2;
n n 272         PyObject *tmp_mvar_value_4;
277         CHECK_OBJECT(var_s); 273         CHECK_OBJECT(var_s);
278         tmp_left_name_2 = var_s; 274         tmp_left_name_2 = var_s;
n 279         tmp_right_name_2 = LIST_COPY(const_list_float_1000_0_list); n
280         tmp_result = BINARY_OPERATION_ADD_OBJECT_LIST_INPLACE(&tmp_left_name_2, tmp_right_name_2);
281         Py_DECREF(tmp_right_name_2);
282         if (tmp_result == false) {
283             assert(ERROR_OCCURRED());
284  
285             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
286  
287  
288             exception_lineno = 35;
289             type_description_1 = "oo";
290             goto frame_exception_exit_1;
291         }
292         tmp_assign_source_4 = tmp_left_name_2;
293         var_s = tmp_assign_source_4;
294  
295     }
296     {
297         PyObject *tmp_assign_source_5;
298         PyObject *tmp_left_name_3;
299         PyObject *tmp_right_name_3;
300         PyObject *tmp_mvar_value_4;
301         CHECK_OBJECT(var_s);
302         tmp_left_name_3 = var_s;
303         tmp_mvar_value_4 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2); 275         tmp_mvar_value_4 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2);
304 276
305         if (unlikely(tmp_mvar_value_4 == NULL)) { 277         if (unlikely(tmp_mvar_value_4 == NULL)) {
306             tmp_mvar_value_4 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2); 278             tmp_mvar_value_4 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2);
307         } 279         }
318             exception_lineno = 37; 290             exception_lineno = 37;
319             type_description_1 = "oo"; 291             type_description_1 = "oo";
320             goto frame_exception_exit_1; 292             goto frame_exception_exit_1;
321         } 293         }
322 294
n 323         tmp_right_name_3 = tmp_mvar_value_4; n 295         tmp_right_name_2 = tmp_mvar_value_4;
324         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_3, tmp_right_name_3); 296         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_2, tmp_right_name_2);
325         if (tmp_result == false) { 297         if (tmp_result == false) {
326             assert(ERROR_OCCURRED()); 298             assert(ERROR_OCCURRED());
327 299
328             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 300             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
329 301
330 302
331             exception_lineno = 37; 303             exception_lineno = 37;
332             type_description_1 = "oo"; 304             type_description_1 = "oo";
333             goto frame_exception_exit_1; 305             goto frame_exception_exit_1;
334         } 306         }
t 335         tmp_assign_source_5 = tmp_left_name_3; t 307         tmp_assign_source_4 = tmp_left_name_2;
336         var_s = tmp_assign_source_5; 308         var_s = tmp_assign_source_4;
337 309
338     } 310     }
339 311
340 #if 0 312 #if 0
341     RESTORE_FRAME_EXCEPTION(frame_88d715eaf8a25262c917217da62e0c1d); 313     RESTORE_FRAME_EXCEPTION(frame_88d715eaf8a25262c917217da62e0c1d);