Construct InplaceOperationListAdd

Performance Diagrams

Construct InplaceOperationListAdd 0040000004000000800000080000001200000012000000160000001600000020000000200000002400000024000000280000002800000032000000320000003600000036000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)3630692288.95192307692307257.0CPython 2.719652437242.31730769230768370.35522924102884Nuitka (master)19653204395.6826923076923370.3500088177718Nuitka (develop)19651599549.0480769230769370.3609329107673Nuitka (factory)Construct InplaceOperationListAddTicks Construct InplaceOperationListAdd 004000000400000080000008000000120000001200000016000000160000002000000020000000240000002400000028000000280000003200000032000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3417779388.95192307692307257.0CPython 3.521050373242.31730769230768351.9150649460512Nuitka (master)21050456395.6826923076923351.91446483190913Nuitka (develop)21050392549.0480769230769351.9149275705247Nuitka (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_list_float_5_0_list; 39 static PyObject *const_list_float_5_0_list;
41 static PyObject *const_str_digest_22d41735d2cf3cd6c6cb71d5735befd4; 40 static PyObject *const_str_digest_22d41735d2cf3cd6c6cb71d5735befd4;
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_list_float_5_0_list = PyList_New( 1 ); 76     const_list_float_5_0_list = PyList_New( 1 );
82     PyList_SET_ITEM(const_list_float_5_0_list, 0, const_float_5_0); Py_INCREF(const_float_5_0); 77     PyList_SET_ITEM(const_list_float_5_0_list, 0, const_float_5_0); Py_INCREF(const_float_5_0);
n 83     const_str_digest_22d41735d2cf3cd6c6cb71d5735befd4 = UNSTREAM_STRING_ASCII( &constant_bin[ 141 ], 48, 0 ); n 78     const_str_digest_22d41735d2cf3cd6c6cb71d5735befd4 = UNSTREAM_STRING_ASCII( &constant_bin[ 133 ], 48, 0 );
84     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 189 ] ); 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;
277     } 272     }
278     { 273     {
279         PyObject *tmp_assign_source_4; 274         PyObject *tmp_assign_source_4;
280         PyObject *tmp_left_name_2; 275         PyObject *tmp_left_name_2;
281         PyObject *tmp_right_name_2; 276         PyObject *tmp_right_name_2;
n n 277         PyObject *tmp_mvar_value_4;
282         CHECK_OBJECT(var_s); 278         CHECK_OBJECT(var_s);
283         tmp_left_name_2 = var_s; 279         tmp_left_name_2 = var_s;
n 284         tmp_right_name_2 = LIST_COPY( const_list_float_1000_0_list ); n
285         tmp_result = BINARY_OPERATION_ADD_OBJECT_LIST_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
286         Py_DECREF(tmp_right_name_2);
287         if ( tmp_result == false )
288         {
289             assert(ERROR_OCCURRED());
290  
291             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
292  
293  
294             exception_lineno = 35;
295             type_description_1 = "oo";
296             goto frame_exception_exit_1;
297         }
298         tmp_assign_source_4 = tmp_left_name_2;
299         var_s = tmp_assign_source_4;
300  
301     }
302     {
303         PyObject *tmp_assign_source_5;
304         PyObject *tmp_left_name_3;
305         PyObject *tmp_right_name_3;
306         PyObject *tmp_mvar_value_4;
307         CHECK_OBJECT(var_s);
308         tmp_left_name_3 = var_s;
309         tmp_mvar_value_4 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2); 280         tmp_mvar_value_4 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2);
310 281
311         if (unlikely( tmp_mvar_value_4 == NULL )) { 282         if (unlikely( tmp_mvar_value_4 == NULL )) {
312             tmp_mvar_value_4 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2); 283             tmp_mvar_value_4 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2);
313         } 284         }
325             exception_lineno = 37; 296             exception_lineno = 37;
326             type_description_1 = "oo"; 297             type_description_1 = "oo";
327             goto frame_exception_exit_1; 298             goto frame_exception_exit_1;
328         } 299         }
329 300
n 330         tmp_right_name_3 = tmp_mvar_value_4; n 301         tmp_right_name_2 = tmp_mvar_value_4;
331         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); 302         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
332         if ( tmp_result == false ) 303         if ( tmp_result == false )
333         { 304         {
334             assert(ERROR_OCCURRED()); 305             assert(ERROR_OCCURRED());
335 306
336             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 307             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
338 309
339             exception_lineno = 37; 310             exception_lineno = 37;
340             type_description_1 = "oo"; 311             type_description_1 = "oo";
341             goto frame_exception_exit_1; 312             goto frame_exception_exit_1;
342         } 313         }
t 343         tmp_assign_source_5 = tmp_left_name_3; t 314         tmp_assign_source_4 = tmp_left_name_2;
344         var_s = tmp_assign_source_5; 315         var_s = tmp_assign_source_4;
345 316
346     } 317     }
347 318
348 #if 0 319 #if 0
349     RESTORE_FRAME_EXCEPTION(frame_6a558c5678c5abd3182bea77d0d96282); 320     RESTORE_FRAME_EXCEPTION(frame_6a558c5678c5abd3182bea77d0d96282);