Construct InplaceOperationListAdd

Performance Diagrams

Construct InplaceOperationListAdd 0040000004000000800000080000001200000012000000160000001600000020000000200000002400000024000000280000002800000032000000320000003600000036000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)3919021473.61538461538461257.0CPython 2.734552442196.30769230769232286.24364770088937Nuitka (historic)33501077319.0000000000001292.87306968736164Nuitka (master)33501450441.69230769230774292.87071772167803Nuitka (develop)33501079564.3846153846155292.8730570762856Nuitka (factory)Construct InplaceOperationListAddTicks Construct InplaceOperationListAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)4998534673.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)33907392319.0000000000001336.4854913385708Nuitka (master)33882026441.69230769230774336.6108946687018Nuitka (develop)33884438564.3846153846155336.5989703277621Nuitka (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;
51 static PyObject *const_str_plain_module_value1; 50 static PyObject *const_str_plain_module_value1;
52 static PyObject *const_str_digest_5caa181efa97df8af567d56caa7d1b07; 51 static PyObject *const_str_digest_5caa181efa97df8af567d56caa7d1b07;
53 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 52 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
54 static PyObject *const_str_plain_calledRepeatedly; 53 static PyObject *const_str_plain_calledRepeatedly;
55 static PyObject *const_list_float_2_0_list; 54 static PyObject *const_list_float_2_0_list;
n 56 static PyObject *const_float_1000_0; n
57 static PyObject *const_str_angle_module; 55 static PyObject *const_str_angle_module;
58 static PyObject *const_str_plain_x; 56 static PyObject *const_str_plain_x;
59 extern PyObject *const_tuple_empty; 57 extern PyObject *const_tuple_empty;
60 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 58 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
61 extern PyObject *const_str_plain___loader__; 59 extern PyObject *const_str_plain___loader__;
72     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 0 ], 11, 1 ); 70     const_str_plain___package__ = UNSTREAM_STRING( &constant_bin[ 0 ], 11, 1 );
73     const_str_plain_s = UNSTREAM_STRING( &constant_bin[ 11 ], 1, 1 ); 71     const_str_plain_s = UNSTREAM_STRING( &constant_bin[ 11 ], 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[ 12 ] ); 73     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 12 ] );
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[ 20 ] );
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[ 28 ] ); 75     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 20 ] );
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 );
83     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 78     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
84     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 ); 79     const_xrange_0_50000 = BUILTIN_XRANGE3( const_int_0, const_int_pos_50000, const_int_pos_1 );
n 85     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 36 ] ); n 80     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 28 ] );
86     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 44 ], 11, 1 ); 81     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 36 ], 11, 1 );
87     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 55 ], 13, 1 ); 82     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 47 ], 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( &constant_bin[ 68 ], 3, 0 ); n 84     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 60 ], 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( &constant_bin[ 71 ], 13, 1 ); n 86     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 63 ], 13, 1 );
92     const_str_digest_5caa181efa97df8af567d56caa7d1b07 = UNSTREAM_STRING( &constant_bin[ 84 ], 81, 0 ); 87     const_str_digest_5caa181efa97df8af567d56caa7d1b07 = UNSTREAM_STRING( &constant_bin[ 76 ], 81, 0 );
93     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 88     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
94     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s ); 89     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s );
95     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 ); 90     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 96     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 165 ], 16, 1 ); n 91     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 157 ], 16, 1 );
97     const_list_float_2_0_list = PyList_New( 1 ); 92     const_list_float_2_0_list = PyList_New( 1 );
98     PyList_SET_ITEM( const_list_float_2_0_list, 0, const_float_2_0 ); Py_INCREF( const_float_2_0 ); 93     PyList_SET_ITEM( const_list_float_2_0_list, 0, const_float_2_0 ); Py_INCREF( const_float_2_0 );
n 99     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 181 ], 8, 0 ); n 94     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 173 ], 8, 0 );
100     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 109 ], 1, 1 ); 95     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 101 ], 1, 1 );
101 96
102     constants_created = true; 97     constants_created = true;
103 } 98 }
104 99
105 #ifndef __NUITKA_NO_ASSERT__ 100 #ifndef __NUITKA_NO_ASSERT__
150     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 145     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
151     PyObject *tmp_assign_source_1; 146     PyObject *tmp_assign_source_1;
152     PyObject *tmp_assign_source_2; 147     PyObject *tmp_assign_source_2;
153     PyObject *tmp_assign_source_3; 148     PyObject *tmp_assign_source_3;
154     PyObject *tmp_assign_source_4; 149     PyObject *tmp_assign_source_4;
n 155     PyObject *tmp_assign_source_5; n
156     PyObject *tmp_frame_locals; 150     PyObject *tmp_frame_locals;
157     PyObject *tmp_left_name_1; 151     PyObject *tmp_left_name_1;
158     PyObject *tmp_left_name_2; 152     PyObject *tmp_left_name_2;
n 159     PyObject *tmp_left_name_3; n
160     bool tmp_result; 153     bool tmp_result;
161     PyObject *tmp_return_value; 154     PyObject *tmp_return_value;
162     PyObject *tmp_right_name_1; 155     PyObject *tmp_right_name_1;
163     PyObject *tmp_right_name_2; 156     PyObject *tmp_right_name_2;
n 164     PyObject *tmp_right_name_3; n
165     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 157     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
166     static PyFrameObject *cache_frame_function = NULL; 158     static PyFrameObject *cache_frame_function = NULL;
167 159
168     PyFrameObject *frame_function; 160     PyFrameObject *frame_function;
169 161
273     } 265     }
274     var_s = tmp_assign_source_3; 266     var_s = tmp_assign_source_3;
275 267
276     tmp_left_name_2 = var_s; 268     tmp_left_name_2 = var_s;
277 269
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         goto frame_exception_exit_1;
291     }
292     var_s = tmp_assign_source_4;
293  
294     tmp_left_name_3 = var_s;
295  
296     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 );
297 271
n 298     if (unlikely( tmp_right_name_3 == NULL )) n 272     if (unlikely( tmp_right_name_2 == NULL ))
299     { 273     {
n 300         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 );
301     } 275     }
302 276
n 303     if ( tmp_right_name_3 == NULL ) n 277     if ( tmp_right_name_2 == NULL )
304     { 278     {
305 279
306         exception_type = PyExc_NameError; 280         exception_type = PyExc_NameError;
307         Py_INCREF( exception_type ); 281         Py_INCREF( exception_type );
308         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 282         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
312 286
313         exception_lineno = 37; 287         exception_lineno = 37;
314         goto frame_exception_exit_1; 288         goto frame_exception_exit_1;
315     } 289     }
316 290
n 317     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); n 291     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
318     tmp_assign_source_5 = tmp_left_name_3; 292     tmp_assign_source_4 = tmp_left_name_2;
319     if ( tmp_result == false ) 293     if ( tmp_result == false )
320     { 294     {
321         assert( ERROR_OCCURRED() ); 295         assert( ERROR_OCCURRED() );
322 296
323         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 297         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
324 298
325 299
326         exception_lineno = 37; 300         exception_lineno = 37;
327         goto frame_exception_exit_1; 301         goto frame_exception_exit_1;
328     } 302     }
t 329     var_s = tmp_assign_source_5; t 303     var_s = tmp_assign_source_4;
330 304
331 305
332 #if 0 306 #if 0
333     RESTORE_FRAME_EXCEPTION( frame_function ); 307     RESTORE_FRAME_EXCEPTION( frame_function );
334 #endif 308 #endif