Construct InplaceOperationListAdd

Performance Diagrams

Construct InplaceOperationListAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)4135543588.95192307692307257.0CPython 2.724000556242.31730769230768360.7023936282731Nuitka (master)24001046395.6826923076923360.69946568087124Nuitka (develop)24001778549.0480769230769360.695091685977Nuitka (factory)Construct InplaceOperationListAddTicks Construct InplaceOperationListAdd 0040000004000000800000080000001200000012000000160000001600000020000000200000002400000024000000280000002800000032000000320000003600000036000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3807851388.95192307692307257.0CPython 3.524854634242.31730769230768342.8180555840588Nuitka (master)24859669395.6826923076923342.78538030701907Nuitka (develop)24854461549.0480769230769342.8191782897049Nuitka (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 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_digest_6e4e4d50ea5183f64e1678f69b26c60d; 53 static PyObject *const_str_digest_6e4e4d50ea5183f64e1678f69b26c60d;
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;
73     const_str_plain_itertools = UNSTREAM_STRING_ASCII( &constant_bin[ 0 ], 9, 1 ); 71     const_str_plain_itertools = UNSTREAM_STRING_ASCII( &constant_bin[ 0 ], 9, 1 );
74     const_str_plain_s = UNSTREAM_STRING_ASCII( &constant_bin[ 8 ], 1, 1 ); 72     const_str_plain_s = UNSTREAM_STRING_ASCII( &constant_bin[ 8 ], 1, 1 );
75     const_list_float_3_0_list = PyList_New( 1 ); 73     const_list_float_3_0_list = PyList_New( 1 );
76     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 9 ] ); 74     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 9 ] );
77     PyList_SET_ITEM( const_list_float_3_0_list, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 ); 75     PyList_SET_ITEM( const_list_float_3_0_list, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 );
n 78     const_list_float_1000_0_list = PyList_New( 1 ); n
79     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 17 ] );
80     PyList_SET_ITEM( const_list_float_1000_0_list, 0, const_float_1000_0 ); Py_INCREF( const_float_1000_0 );
81     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 25 ] ); 76     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 17 ] );
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[ 33 ] ); n 79     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 25 ] );
85     const_str_plain_local_value = UNSTREAM_STRING_ASCII( &constant_bin[ 41 ], 11, 1 ); 80     const_str_plain_local_value = UNSTREAM_STRING_ASCII( &constant_bin[ 33 ], 11, 1 );
86     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 81     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
n 87     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII( &constant_bin[ 52 ], 13, 1 ); n 82     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII( &constant_bin[ 44 ], 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[ 65 ], 3, 0 ); n 84     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 57 ], 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 );
n 91     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII( &constant_bin[ 68 ], 13, 1 ); n 86     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII( &constant_bin[ 60 ], 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 );
n 95     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 81 ], 16, 1 ); n 90     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 73 ], 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[ 97 ], 8, 0 ); n 93     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 89 ], 8, 0 );
99     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 105 ], 4, 1 ); 94     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 97 ], 4, 1 );
100     const_str_digest_6e4e4d50ea5183f64e1678f69b26c60d = UNSTREAM_STRING_ASCII( &constant_bin[ 109 ], 74, 0 ); 95     const_str_digest_6e4e4d50ea5183f64e1678f69b26c60d = UNSTREAM_STRING_ASCII( &constant_bin[ 101 ], 74, 0 );
101     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 134 ], 1, 1 ); 96     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 126 ], 1, 1 );
102     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 183 ], 6, 1 ); 97     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 175 ], 6, 1 );
103     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 98     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
104     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, 0, Py_None ); Py_INCREF( Py_None );
105     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 100     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
106 101
107     constants_created = true; 102     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_10fa9bf26412817c4b7284ae6a9051de ); 326     RESTORE_FRAME_EXCEPTION( frame_10fa9bf26412817c4b7284ae6a9051de );