Construct InplaceOperationListAdd

Performance Diagrams

Construct InplaceOperationListAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)4170288388.95192307692307261.43950359652547CPython 2.742465794242.31730769230768257.00000000000006Nuitka (master)42453632395.6826923076923257.0707726625268Nuitka (develop)42464880549.0480769230769257.0053187151414Nuitka (factory)Construct InplaceOperationListAddTicks Construct InplaceOperationListAdd 0040000004000000800000080000001200000012000000160000001600000020000000200000002400000024000000280000002800000032000000320000003600000036000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3787790588.95192307692307257.0CPython 3.531502787242.31730769230768298.5912584536674Nuitka (master)31501631395.6826923076923298.5988001956042Nuitka (develop)31671151549.0480769230769297.49285201816406Nuitka (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
35 static PyObject *const_str_plain_itertools; 35 static PyObject *const_str_plain_itertools;
36 static PyObject *const_str_plain___package__; 36 static PyObject *const_str_plain___package__;
37 static PyObject *const_str_plain___spec__; 37 static PyObject *const_str_plain___spec__;
38 static PyObject *const_str_plain_s; 38 static PyObject *const_str_plain_s;
39 static PyObject *const_list_float_3_0_list; 39 static PyObject *const_list_float_3_0_list;
n 40 static PyObject *const_list_float_1000_0_list; n
41 extern PyObject *const_dict_empty; 40 extern PyObject *const_dict_empty;
42 extern PyObject *const_str_plain___file__; 41 extern PyObject *const_str_plain___file__;
43 static PyObject *const_float_5_0; 42 static PyObject *const_float_5_0;
44 static PyObject *const_list_float_5_0_list; 43 static PyObject *const_list_float_5_0_list;
45 extern PyObject *const_int_0; 44 extern PyObject *const_int_0;
51 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 50 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
52 static PyObject *const_str_plain_module_value1; 51 static PyObject *const_str_plain_module_value1;
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 static PyObject *const_str_plain_repeat; 59 static PyObject *const_str_plain_repeat;
77     const_str_plain___spec__ = UNSTREAM_STRING( &constant_bin[ 101 ], 8, 1 ); 75     const_str_plain___spec__ = UNSTREAM_STRING( &constant_bin[ 101 ], 8, 1 );
78     const_str_plain_s = UNSTREAM_STRING( &constant_bin[ 38 ], 1, 1 ); 76     const_str_plain_s = UNSTREAM_STRING( &constant_bin[ 38 ], 1, 1 );
79     const_list_float_3_0_list = PyList_New( 1 ); 77     const_list_float_3_0_list = PyList_New( 1 );
80     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 109 ] ); 78     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 109 ] );
81     PyList_SET_ITEM( const_list_float_3_0_list, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 ); 79     PyList_SET_ITEM( const_list_float_3_0_list, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 );
n 82     const_list_float_1000_0_list = PyList_New( 1 ); n
83     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 117 ] );
84     PyList_SET_ITEM( const_list_float_1000_0_list, 0, const_float_1000_0 ); Py_INCREF( const_float_1000_0 );
85     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 125 ] ); 80     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 117 ] );
86     const_list_float_5_0_list = PyList_New( 1 ); 81     const_list_float_5_0_list = PyList_New( 1 );
87     PyList_SET_ITEM( const_list_float_5_0_list, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 ); 82     PyList_SET_ITEM( const_list_float_5_0_list, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 );
n 88     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 133 ] ); n 83     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 125 ] );
89     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 141 ], 11, 1 ); 84     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 133 ], 11, 1 );
90     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 85     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
n 91     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 152 ], 13, 1 ); n 86     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 144 ], 13, 1 );
92     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 87     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 93     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 165 ], 3, 0 ); n 88     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 157 ], 3, 0 );
94     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 89     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 95     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 168 ], 13, 1 ); n 90     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 160 ], 13, 1 );
96     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 91     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
97     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, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s );
98     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 ); 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 );
n 99     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 181 ], 16, 1 ); n 94     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 173 ], 16, 1 );
100     const_list_float_2_0_list = PyList_New( 1 ); 95     const_list_float_2_0_list = PyList_New( 1 );
101     PyList_SET_ITEM( const_list_float_2_0_list, 0, const_float_2_0 ); Py_INCREF( const_float_2_0 ); 96     PyList_SET_ITEM( const_list_float_2_0_list, 0, const_float_2_0 ); Py_INCREF( const_float_2_0 );
n 102     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 197 ], 8, 0 ); n 97     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 189 ], 8, 0 );
103     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 25 ], 1, 1 ); 98     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 25 ], 1, 1 );
n 104     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 205 ], 6, 1 ); n 99     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 197 ], 6, 1 );
105     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 100     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
106     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 101     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
107     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 102     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
108 103
109     constants_created = true; 104     constants_created = true;
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_553c5fd4ff0d969100a40c1d377ccea6 = NULL; 165     static struct Nuitka_FrameObject *cache_frame_553c5fd4ff0d969100a40c1d377ccea6 = NULL;
174 166
175     struct Nuitka_FrameObject *frame_553c5fd4ff0d969100a40c1d377ccea6; 167     struct Nuitka_FrameObject *frame_553c5fd4ff0d969100a40c1d377ccea6;
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_1 = "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_1 = "oo"; 297         type_description_1 = "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_1 = "oo"; 311         type_description_1 = "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_553c5fd4ff0d969100a40c1d377ccea6 ); 318     RESTORE_FRAME_EXCEPTION( frame_553c5fd4ff0d969100a40c1d377ccea6 );
347 #endif 319 #endif