Construct InplaceOperationListAdd

Performance Diagrams

Construct InplaceOperationListAdd 0040000004000000800000080000001200000012000000160000001600000020000000200000002400000024000000280000002800000032000000320000003600000036000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)3919021473.61538461538461257.0CPython 2.734552442196.30769230769232286.24364770088937Nuitka (historic)33600746319.0000000000001292.2446030178703Nuitka (master)33612164441.69230769230774292.172606384692Nuitka (develop)33604768564.3846153846155292.21924214393067Nuitka (factory)Construct InplaceOperationListAddTicks Construct InplaceOperationListAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)4998534673.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)31690326319.0000000000001347.4461260275392Nuitka (master)33619469441.69230769230774337.9089125725583Nuitka (develop)33948190564.3846153846155336.2837959564574Nuitka (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

for x in xrange(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

for x in xrange(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 for x in xrange(50000): 41 for x in xrange(50000):

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___package__; 34 static PyObject *const_str_plain___package__;
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_int_pos_1; 37 extern PyObject *const_int_pos_1;
39 extern PyObject *const_dict_empty; 38 extern PyObject *const_dict_empty;
40 extern PyObject *const_str_plain___file__; 39 extern PyObject *const_str_plain___file__;
41 static PyObject *const_float_5_0; 40 static PyObject *const_float_5_0;
42 static PyObject *const_list_float_5_0_list; 41 static PyObject *const_list_float_5_0_list;
50 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 49 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
51 static PyObject *const_str_plain_module_value1; 50 static PyObject *const_str_plain_module_value1;
52 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 51 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
53 static PyObject *const_str_plain_calledRepeatedly; 52 static PyObject *const_str_plain_calledRepeatedly;
54 static PyObject *const_list_float_2_0_list; 53 static PyObject *const_list_float_2_0_list;
n 55 static PyObject *const_float_1000_0; n
56 static PyObject *const_str_angle_module; 54 static PyObject *const_str_angle_module;
57 static PyObject *const_str_plain_x; 55 static PyObject *const_str_plain_x;
58 extern PyObject *const_tuple_empty; 56 extern PyObject *const_tuple_empty;
59 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 57 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
60 extern PyObject *const_str_plain___main__; 58 extern PyObject *const_str_plain___main__;
71     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 0 ], 11, 1 ); 69     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 0 ], 11, 1 );
72     const_str_plain_s = UNSTREAM_STRING( &constant_bin[ 11 ], 1, 1 ); 70     const_str_plain_s = UNSTREAM_STRING( &constant_bin[ 11 ], 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[ 12 ] ); 72     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 12 ] );
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[ 20 ] );
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[ 28 ] ); 74     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 20 ] );
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 );
82     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 77     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
83     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 ); 78     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 );
n 84     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 36 ] ); n 79     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 28 ] );
85     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 44 ], 11, 1 ); 80     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 36 ], 11, 1 );
86     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 55 ], 13, 1 ); 81     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 47 ], 13, 1 );
87     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 82     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 88     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 68 ], 3, 0 ); n 83     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 60 ], 3, 0 );
89     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 84     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 90     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 71 ], 13, 1 ); n 85     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 63 ], 13, 1 );
91     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 86     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
92     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s ); 87     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s );
93     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 ); 88     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 94     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 84 ], 16, 1 ); n 89     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 76 ], 16, 1 );
95     const_list_float_2_0_list = PyList_New( 1 ); 90     const_list_float_2_0_list = PyList_New( 1 );
96     PyList_SET_ITEM( const_list_float_2_0_list, 0, const_float_2_0 ); Py_INCREF( const_float_2_0 ); 91     PyList_SET_ITEM( const_list_float_2_0_list, 0, const_float_2_0 ); Py_INCREF( const_float_2_0 );
n 97     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 100 ], 8, 0 ); n 92     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 92 ], 8, 0 );
98     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 108 ], 1, 1 ); 93     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 100 ], 1, 1 );
99     const_str_digest_a54361a44d8a65aefc22b316415e1e69 = UNSTREAM_STRING( &constant_bin[ 109 ], 81, 0 ); 94     const_str_digest_a54361a44d8a65aefc22b316415e1e69 = UNSTREAM_STRING( &constant_bin[ 101 ], 81, 0 );
100 95
101     constants_created = true; 96     constants_created = true;
102 } 97 }
103 98
104 #ifndef __NUITKA_NO_ASSERT__ 99 #ifndef __NUITKA_NO_ASSERT__
149     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 144     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
150     PyObject *tmp_assign_source_1; 145     PyObject *tmp_assign_source_1;
151     PyObject *tmp_assign_source_2; 146     PyObject *tmp_assign_source_2;
152     PyObject *tmp_assign_source_3; 147     PyObject *tmp_assign_source_3;
153     PyObject *tmp_assign_source_4; 148     PyObject *tmp_assign_source_4;
n 154     PyObject *tmp_assign_source_5; n
155     PyObject *tmp_left_name_1; 149     PyObject *tmp_left_name_1;
156     PyObject *tmp_left_name_2; 150     PyObject *tmp_left_name_2;
n 157     PyObject *tmp_left_name_3; n
158     bool tmp_result; 151     bool tmp_result;
159     PyObject *tmp_return_value; 152     PyObject *tmp_return_value;
160     PyObject *tmp_right_name_1; 153     PyObject *tmp_right_name_1;
161     PyObject *tmp_right_name_2; 154     PyObject *tmp_right_name_2;
n 162     PyObject *tmp_right_name_3; n
163     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 155     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
164     static struct Nuitka_FrameObject *cache_frame_bba5821dbd9a55992a157be5dc8f011d = NULL; 156     static struct Nuitka_FrameObject *cache_frame_bba5821dbd9a55992a157be5dc8f011d = NULL;
165 157
166     struct Nuitka_FrameObject *frame_bba5821dbd9a55992a157be5dc8f011d; 158     struct Nuitka_FrameObject *frame_bba5821dbd9a55992a157be5dc8f011d;
167 159
273     var_s = tmp_assign_source_3; 265     var_s = tmp_assign_source_3;
274 266
275     tmp_left_name_2 = var_s; 267     tmp_left_name_2 = var_s;
276 268
277     CHECK_OBJECT( tmp_left_name_2 ); 269     CHECK_OBJECT( tmp_left_name_2 );
n 278     tmp_right_name_2 = LIST_COPY( const_list_float_1000_0_list ); n
279     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
280     tmp_assign_source_4 = tmp_left_name_2;
281     Py_DECREF( tmp_right_name_2 );
282     if ( tmp_result == false )
283     {
284         assert( ERROR_OCCURRED() );
285  
286         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
287  
288  
289         exception_lineno = 35;
290         type_description = "oo";
291         goto frame_exception_exit_1;
292     }
293     var_s = tmp_assign_source_4;
294  
295     tmp_left_name_3 = var_s;
296  
297     CHECK_OBJECT( tmp_left_name_3 );
298     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 270     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
299 271
n 300     if (unlikely( tmp_right_name_3 == NULL )) n 272     if (unlikely( tmp_right_name_2 == NULL ))
301     { 273     {
n 302         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 274         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
303     } 275     }
304 276
n 305     if ( tmp_right_name_3 == NULL ) n 277     if ( tmp_right_name_2 == NULL )
306     { 278     {
307 279
308         exception_type = PyExc_NameError; 280         exception_type = PyExc_NameError;
309         Py_INCREF( exception_type ); 281         Py_INCREF( exception_type );
310         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 282         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
315         exception_lineno = 37; 287         exception_lineno = 37;
316         type_description = "oo"; 288         type_description = "oo";
317         goto frame_exception_exit_1; 289         goto frame_exception_exit_1;
318     } 290     }
319 291
n 320     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); n 292     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
321     tmp_assign_source_5 = tmp_left_name_3; 293     tmp_assign_source_4 = tmp_left_name_2;
322     if ( tmp_result == false ) 294     if ( tmp_result == false )
323     { 295     {
324         assert( ERROR_OCCURRED() ); 296         assert( ERROR_OCCURRED() );
325 297
326         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 298         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
328 300
329         exception_lineno = 37; 301         exception_lineno = 37;
330         type_description = "oo"; 302         type_description = "oo";
331         goto frame_exception_exit_1; 303         goto frame_exception_exit_1;
332     } 304     }
t 333     var_s = tmp_assign_source_5; t 305     var_s = tmp_assign_source_4;
334 306
335 307
336 #if 0 308 #if 0
337     RESTORE_FRAME_EXCEPTION( frame_bba5821dbd9a55992a157be5dc8f011d ); 309     RESTORE_FRAME_EXCEPTION( frame_bba5821dbd9a55992a157be5dc8f011d );
338 #endif 310 #endif