Construct InplaceOperationListAdd

Performance Diagrams

Construct InplaceOperationListAdd 0040000004000000800000080000001200000012000000160000001600000020000000200000002400000024000000280000002800000032000000320000003600000036000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)3919111988.95192307692307257.00000000000006CPython 2.733470011242.31730769230768293.0738310086567Nuitka (master)33601660395.6826923076923292.2437324021528Nuitka (develop)33603180549.0480769230769292.23414820567666Nuitka (factory)Construct InplaceOperationListAddTicks Construct InplaceOperationListAdd 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5288124188.95192307692307257.0CPython 3.533628209242.31730769230768346.9699083781394Nuitka (master)33293691395.6826923076923348.5331195030593Nuitka (develop)33285232549.0480769230769348.572648625276Nuitka (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
34 static PyObject *const_str_plain_itertools; 34 static PyObject *const_str_plain_itertools;
35 static PyObject *const_str_plain___package__; 35 static PyObject *const_str_plain___package__;
36 static PyObject *const_str_plain___spec__; 36 static PyObject *const_str_plain___spec__;
37 static PyObject *const_str_plain_s; 37 static PyObject *const_str_plain_s;
38 static PyObject *const_list_float_3_0_list; 38 static PyObject *const_list_float_3_0_list;
n 39 static PyObject *const_list_float_1000_0_list; n
40 extern PyObject *const_dict_empty; 39 extern PyObject *const_dict_empty;
41 extern PyObject *const_str_plain___file__; 40 extern PyObject *const_str_plain___file__;
42 static PyObject *const_float_5_0; 41 static PyObject *const_float_5_0;
43 static PyObject *const_list_float_5_0_list; 42 static PyObject *const_list_float_5_0_list;
44 extern PyObject *const_int_0; 43 extern PyObject *const_int_0;
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 static PyObject *const_str_plain_repeat; 58 static PyObject *const_str_plain_repeat;
76     const_str_plain___spec__ = UNSTREAM_STRING( &constant_bin[ 20 ], 8, 1 ); 74     const_str_plain___spec__ = UNSTREAM_STRING( &constant_bin[ 20 ], 8, 1 );
77     const_str_plain_s = UNSTREAM_STRING( &constant_bin[ 8 ], 1, 1 ); 75     const_str_plain_s = UNSTREAM_STRING( &constant_bin[ 8 ], 1, 1 );
78     const_list_float_3_0_list = PyList_New( 1 ); 76     const_list_float_3_0_list = PyList_New( 1 );
79     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 28 ] ); 77     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 28 ] );
80     PyList_SET_ITEM( const_list_float_3_0_list, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 ); 78     PyList_SET_ITEM( const_list_float_3_0_list, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 );
n 81     const_list_float_1000_0_list = PyList_New( 1 ); n
82     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 36 ] );
83     PyList_SET_ITEM( const_list_float_1000_0_list, 0, const_float_1000_0 ); Py_INCREF( const_float_1000_0 );
84     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 44 ] ); 79     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 36 ] );
85     const_list_float_5_0_list = PyList_New( 1 ); 80     const_list_float_5_0_list = PyList_New( 1 );
86     PyList_SET_ITEM( const_list_float_5_0_list, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 ); 81     PyList_SET_ITEM( const_list_float_5_0_list, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 );
n 87     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 52 ] ); n 82     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 44 ] );
88     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 60 ], 11, 1 ); 83     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 52 ], 11, 1 );
89     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 84     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
n 90     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 71 ], 13, 1 ); n 85     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 63 ], 13, 1 );
91     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 86     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 92     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 84 ], 3, 0 ); n 87     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 76 ], 3, 0 );
93     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 88     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 94     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 87 ], 13, 1 ); n 89     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 79 ], 13, 1 );
95     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 90     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
96     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s ); 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 );
97     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 ); 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 );
n 98     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 100 ], 16, 1 ); n 93     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 92 ], 16, 1 );
99     const_list_float_2_0_list = PyList_New( 1 ); 94     const_list_float_2_0_list = PyList_New( 1 );
100     PyList_SET_ITEM( const_list_float_2_0_list, 0, const_float_2_0 ); Py_INCREF( const_float_2_0 ); 95     PyList_SET_ITEM( const_list_float_2_0_list, 0, const_float_2_0 ); Py_INCREF( const_float_2_0 );
n 101     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 116 ], 8, 0 ); n 96     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 108 ], 8, 0 );
102     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 124 ], 1, 1 ); 97     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 116 ], 1, 1 );
103     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 125 ], 6, 1 ); 98     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 117 ], 6, 1 );
104     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 99     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
105     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 100     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
106     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 101     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 107     const_str_digest_8b58b310f110756d9f062f950fba7ffc = UNSTREAM_STRING( &constant_bin[ 131 ], 81, 0 ); n 102     const_str_digest_8b58b310f110756d9f062f950fba7ffc = UNSTREAM_STRING( &constant_bin[ 123 ], 81, 0 );
108 103
109     constants_created = true; 104     constants_created = true;
110 } 105 }
111 106
112 #ifndef __NUITKA_NO_ASSERT__ 107 #ifndef __NUITKA_NO_ASSERT__
158     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 153     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
159     PyObject *tmp_assign_source_1; 154     PyObject *tmp_assign_source_1;
160     PyObject *tmp_assign_source_2; 155     PyObject *tmp_assign_source_2;
161     PyObject *tmp_assign_source_3; 156     PyObject *tmp_assign_source_3;
162     PyObject *tmp_assign_source_4; 157     PyObject *tmp_assign_source_4;
n 163     PyObject *tmp_assign_source_5; n
164     PyObject *tmp_left_name_1; 158     PyObject *tmp_left_name_1;
165     PyObject *tmp_left_name_2; 159     PyObject *tmp_left_name_2;
n 166     PyObject *tmp_left_name_3; n
167     bool tmp_result; 160     bool tmp_result;
168     PyObject *tmp_return_value; 161     PyObject *tmp_return_value;
169     PyObject *tmp_right_name_1; 162     PyObject *tmp_right_name_1;
170     PyObject *tmp_right_name_2; 163     PyObject *tmp_right_name_2;
n 171     PyObject *tmp_right_name_3; n
172     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 164     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
173     static struct Nuitka_FrameObject *cache_frame_1d0eefa9cbb4c6a4eab22c92f587f43f = NULL; 165     static struct Nuitka_FrameObject *cache_frame_1d0eefa9cbb4c6a4eab22c92f587f43f = NULL;
174 166
175     struct Nuitka_FrameObject *frame_1d0eefa9cbb4c6a4eab22c92f587f43f; 167     struct Nuitka_FrameObject *frame_1d0eefa9cbb4c6a4eab22c92f587f43f;
176 168
282     var_s = tmp_assign_source_3; 274     var_s = tmp_assign_source_3;
283 275
284     tmp_left_name_2 = var_s; 276     tmp_left_name_2 = var_s;
285 277
286     CHECK_OBJECT( tmp_left_name_2 ); 278     CHECK_OBJECT( tmp_left_name_2 );
n 287     tmp_right_name_2 = LIST_COPY( const_list_float_1000_0_list ); n
288     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
289     tmp_assign_source_4 = tmp_left_name_2;
290     Py_DECREF( tmp_right_name_2 );
291     if ( tmp_result == false )
292     {
293         assert( ERROR_OCCURRED() );
294  
295         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
296  
297  
298         exception_lineno = 35;
299         type_description = "oo";
300         goto frame_exception_exit_1;
301     }
302     var_s = tmp_assign_source_4;
303  
304     tmp_left_name_3 = var_s;
305  
306     CHECK_OBJECT( tmp_left_name_3 );
307     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 279     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
308 280
n 309     if (unlikely( tmp_right_name_3 == NULL )) n 281     if (unlikely( tmp_right_name_2 == NULL ))
310     { 282     {
n 311         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 283         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
312     } 284     }
313 285
n 314     if ( tmp_right_name_3 == NULL ) n 286     if ( tmp_right_name_2 == NULL )
315     { 287     {
316 288
317         exception_type = PyExc_NameError; 289         exception_type = PyExc_NameError;
318         Py_INCREF( exception_type ); 290         Py_INCREF( exception_type );
319         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 291         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
324         exception_lineno = 37; 296         exception_lineno = 37;
325         type_description = "oo"; 297         type_description = "oo";
326         goto frame_exception_exit_1; 298         goto frame_exception_exit_1;
327     } 299     }
328 300
n 329     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); n 301     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
330     tmp_assign_source_5 = tmp_left_name_3; 302     tmp_assign_source_4 = tmp_left_name_2;
331     if ( tmp_result == false ) 303     if ( tmp_result == false )
332     { 304     {
333         assert( ERROR_OCCURRED() ); 305         assert( ERROR_OCCURRED() );
334 306
335         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 307         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
337 309
338         exception_lineno = 37; 310         exception_lineno = 37;
339         type_description = "oo"; 311         type_description = "oo";
340         goto frame_exception_exit_1; 312         goto frame_exception_exit_1;
341     } 313     }
t 342     var_s = tmp_assign_source_5; t 314     var_s = tmp_assign_source_4;
343 315
344 316
345 #if 0 317 #if 0
346     RESTORE_FRAME_EXCEPTION( frame_1d0eefa9cbb4c6a4eab22c92f587f43f ); 318     RESTORE_FRAME_EXCEPTION( frame_1d0eefa9cbb4c6a4eab22c92f587f43f );
347 #endif 319 #endif