Construct InplaceOperationListAdd

Performance Diagrams

Construct InplaceOperationListAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)4165321488.95192307692307257.0CPython 2.731164646242.31730769230768319.225366700025Nuitka (master)32165554395.6826923076923313.2872951412585Nuitka (develop)32092889549.0480769230769313.71839367360894Nuitka (factory)Construct InplaceOperationListAddTicks Construct InplaceOperationListAdd 0040000004000000800000080000001200000012000000160000001600000020000000200000002400000024000000280000002800000032000000320000003600000036000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3787753388.95192307692307257.0CPython 3.523801858242.31730769230768348.830580448472Nuitka (master)24851160395.6826923076923341.98486884133825Nuitka (develop)24850754549.0480769230769341.98751761062726Nuitka (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 module constants used, if any. */ 33 /* The 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 extern PyObject *const_int_0; 40 extern PyObject *const_int_0;
42 static PyObject *const_float_2_0; 41 static PyObject *const_float_2_0;
47 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 46 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
48 static PyObject *const_str_plain_module_value1; 47 static PyObject *const_str_plain_module_value1;
49 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 48 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
50 static PyObject *const_str_plain_calledRepeatedly; 49 static PyObject *const_str_plain_calledRepeatedly;
51 static PyObject *const_list_float_2_0_list; 50 static PyObject *const_list_float_2_0_list;
n 52 static PyObject *const_float_1000_0; n
53 static PyObject *const_str_angle_module; 51 static PyObject *const_str_angle_module;
54 static PyObject *const_str_plain_None; 52 static PyObject *const_str_plain_None;
55 static PyObject *const_str_plain_x; 53 static PyObject *const_str_plain_x;
56 extern PyObject *const_tuple_empty; 54 extern PyObject *const_tuple_empty;
57 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 55 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
71     const_str_plain_itertools = UNSTREAM_STRING_ASCII( &constant_bin[ 0 ], 9, 1 ); 69     const_str_plain_itertools = UNSTREAM_STRING_ASCII( &constant_bin[ 0 ], 9, 1 );
72     const_str_plain_s = UNSTREAM_STRING_ASCII( &constant_bin[ 8 ], 1, 1 ); 70     const_str_plain_s = UNSTREAM_STRING_ASCII( &constant_bin[ 8 ], 1, 1 );
73     const_list_float_3_0_list = PyList_New( 1 ); 71     const_list_float_3_0_list = PyList_New( 1 );
74     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 9 ] ); 72     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 9 ] );
75     PyList_SET_ITEM( const_list_float_3_0_list, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 ); 73     PyList_SET_ITEM( const_list_float_3_0_list, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 );
n 76     const_list_float_1000_0_list = PyList_New( 1 ); n
77     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 17 ] );
78     PyList_SET_ITEM( const_list_float_1000_0_list, 0, const_float_1000_0 ); Py_INCREF( const_float_1000_0 );
79     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 25 ] ); 74     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 17 ] );
80     const_list_float_5_0_list = PyList_New( 1 ); 75     const_list_float_5_0_list = PyList_New( 1 );
81     PyList_SET_ITEM( const_list_float_5_0_list, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 ); 76     PyList_SET_ITEM( const_list_float_5_0_list, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 );
n 82     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 33 ] ); n 77     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 25 ] );
83     const_str_plain_local_value = UNSTREAM_STRING_ASCII( &constant_bin[ 41 ], 11, 1 ); 78     const_str_plain_local_value = UNSTREAM_STRING_ASCII( &constant_bin[ 33 ], 11, 1 );
84     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 79     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
n 85     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII( &constant_bin[ 52 ], 13, 1 ); n 80     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII( &constant_bin[ 44 ], 13, 1 );
86     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 81     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 87     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 65 ], 3, 0 ); n 82     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 57 ], 3, 0 );
88     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 83     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 89     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII( &constant_bin[ 68 ], 13, 1 ); n 84     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII( &constant_bin[ 60 ], 13, 1 );
90     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 85     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
91     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s ); 86     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s );
92     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 ); 87     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 );
n 93     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 81 ], 16, 1 ); n 88     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 73 ], 16, 1 );
94     const_list_float_2_0_list = PyList_New( 1 ); 89     const_list_float_2_0_list = PyList_New( 1 );
95     PyList_SET_ITEM( const_list_float_2_0_list, 0, const_float_2_0 ); Py_INCREF( const_float_2_0 ); 90     PyList_SET_ITEM( const_list_float_2_0_list, 0, const_float_2_0 ); Py_INCREF( const_float_2_0 );
n 96     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 97 ], 8, 0 ); n 91     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 89 ], 8, 0 );
97     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 105 ], 4, 1 ); 92     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 97 ], 4, 1 );
98     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 109 ], 1, 1 ); 93     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 101 ], 1, 1 );
99     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 110 ], 6, 1 ); 94     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 102 ], 6, 1 );
100     const_str_digest_e586d007664eb294365dcd0de53897ec = UNSTREAM_STRING_ASCII( &constant_bin[ 116 ], 74, 0 ); 95     const_str_digest_e586d007664eb294365dcd0de53897ec = UNSTREAM_STRING_ASCII( &constant_bin[ 108 ], 74, 0 );
101     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 96     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
102     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 97     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
103     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 98     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
104 99
105     constants_created = true; 100     constants_created = true;
282     } 277     }
283     { 278     {
284     PyObject *tmp_assign_source_4; 279     PyObject *tmp_assign_source_4;
285     PyObject *tmp_left_name_2; 280     PyObject *tmp_left_name_2;
286     PyObject *tmp_right_name_2; 281     PyObject *tmp_right_name_2;
n n 282     PyObject *tmp_mvar_value_4;
287     CHECK_OBJECT( var_s ); 283     CHECK_OBJECT( var_s );
288     tmp_left_name_2 = var_s; 284     tmp_left_name_2 = var_s;
n 289     tmp_right_name_2 = LIST_COPY( const_list_float_1000_0_list ); n
290     tmp_result = BINARY_OPERATION_ADD_OBJECT_LIST_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
291     Py_DECREF( tmp_right_name_2 );
292     if ( tmp_result == false )
293     {
294         assert( ERROR_OCCURRED() );
295  
296         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
297  
298  
299         exception_lineno = 35;
300         type_description_1 = "oo";
301         goto frame_exception_exit_1;
302     }
303     tmp_assign_source_4 = tmp_left_name_2;
304     var_s = tmp_assign_source_4;
305  
306     }
307     {
308     PyObject *tmp_assign_source_5;
309     PyObject *tmp_left_name_3;
310     PyObject *tmp_right_name_3;
311     PyObject *tmp_mvar_value_4;
312     CHECK_OBJECT( var_s );
313     tmp_left_name_3 = var_s;
314     tmp_mvar_value_4 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 285     tmp_mvar_value_4 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
315 286
316     if (unlikely( tmp_mvar_value_4 == NULL )) 287     if (unlikely( tmp_mvar_value_4 == NULL ))
317     { 288     {
318         tmp_mvar_value_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); 289         tmp_mvar_value_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
331         exception_lineno = 37; 302         exception_lineno = 37;
332         type_description_1 = "oo"; 303         type_description_1 = "oo";
333         goto frame_exception_exit_1; 304         goto frame_exception_exit_1;
334     } 305     }
335 306
n 336     tmp_right_name_3 = tmp_mvar_value_4; n 307     tmp_right_name_2 = tmp_mvar_value_4;
337     tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); 308     tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
338     if ( tmp_result == false ) 309     if ( tmp_result == false )
339     { 310     {
340         assert( ERROR_OCCURRED() ); 311         assert( ERROR_OCCURRED() );
341 312
342         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 313         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
344 315
345         exception_lineno = 37; 316         exception_lineno = 37;
346         type_description_1 = "oo"; 317         type_description_1 = "oo";
347         goto frame_exception_exit_1; 318         goto frame_exception_exit_1;
348     } 319     }
t 349     tmp_assign_source_5 = tmp_left_name_3; t 320     tmp_assign_source_4 = tmp_left_name_2;
350     var_s = tmp_assign_source_5; 321     var_s = tmp_assign_source_4;
351 322
352     } 323     }
353 324
354 #if 0 325 #if 0
355     RESTORE_FRAME_EXCEPTION( frame_40cb3a46eca167121a1f55e7252091d2 ); 326     RESTORE_FRAME_EXCEPTION( frame_40cb3a46eca167121a1f55e7252091d2 );