Construct InplaceOperationListAdd

Performance Diagrams

Construct InplaceOperationListAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)4165321488.95192307692307262.01097122710166CPython 2.742465097242.31730769230768257.2919966611793Nuitka (master)42515334395.6826923076923257.0Nuitka (develop)42515170549.0480769230769257.000953230735Nuitka (factory)Construct InplaceOperationListAddTicks Construct InplaceOperationListAdd 0040000004000000800000080000001200000012000000160000001600000020000000200000002400000024000000280000002800000032000000320000003600000036000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3787753388.95192307692307257.0CPython 3.531408481242.31730769230768299.2044981936105Nuitka (master)31643687395.6826923076923297.66999959905195Nuitka (develop)31606661549.0480769230769297.91155952933485Nuitka (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 module constants used, if any. */ 33 /* The 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_str_digest_9162cf1c30744efc36b0d2a5a0e59e84; 41 static PyObject *const_str_digest_9162cf1c30744efc36b0d2a5a0e59e84;
48 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 47 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
49 static PyObject *const_str_plain_module_value1; 48 static PyObject *const_str_plain_module_value1;
50 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 49 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
51 static PyObject *const_str_plain_calledRepeatedly; 50 static PyObject *const_str_plain_calledRepeatedly;
52 static PyObject *const_list_float_2_0_list; 51 static PyObject *const_list_float_2_0_list;
n 53 static PyObject *const_float_1000_0; n
54 static PyObject *const_str_angle_module; 52 static PyObject *const_str_angle_module;
55 static PyObject *const_str_plain_None; 53 static PyObject *const_str_plain_None;
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;
58 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 56 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
71     const_str_plain_itertools = UNSTREAM_STRING( &constant_bin[ 0 ], 9, 1 ); 69     const_str_plain_itertools = UNSTREAM_STRING( &constant_bin[ 0 ], 9, 1 );
72     const_str_plain_s = UNSTREAM_STRING( &constant_bin[ 8 ], 1, 1 ); 70     const_str_plain_s = UNSTREAM_STRING( &constant_bin[ 8 ], 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[ 9 ] ); 72     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 9 ] );
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[ 17 ] );
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[ 25 ] ); 74     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 17 ] );
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 );
n 82     const_str_digest_9162cf1c30744efc36b0d2a5a0e59e84 = UNSTREAM_STRING( &constant_bin[ 33 ], 81, 0 ); n 77     const_str_digest_9162cf1c30744efc36b0d2a5a0e59e84 = UNSTREAM_STRING( &constant_bin[ 25 ], 81, 0 );
83     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 114 ] ); 78     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 106 ] );
84     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 122 ], 11, 1 ); 79     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 114 ], 11, 1 );
85     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 80     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
n 86     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 133 ], 13, 1 ); n 81     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 125 ], 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[ 146 ], 3, 0 ); n 83     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 138 ], 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[ 149 ], 13, 1 ); n 85     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 141 ], 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[ 162 ], 16, 1 ); n 89     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 154 ], 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[ 178 ], 8, 0 ); n 92     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 170 ], 8, 0 );
98     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 186 ], 4, 1 ); 93     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 178 ], 4, 1 );
99     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 58 ], 1, 1 ); 94     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 50 ], 1, 1 );
100     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 190 ], 6, 1 ); 95     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 182 ], 6, 1 );
101     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 96     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
102     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 97     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
103     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 98     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
104 99
105     constants_created = true; 100     constants_created = true;
282     PyObject *tmp_left_name_2; 277     PyObject *tmp_left_name_2;
283     PyObject *tmp_right_name_2; 278     PyObject *tmp_right_name_2;
284     tmp_left_name_2 = var_s; 279     tmp_left_name_2 = var_s;
285 280
286     CHECK_OBJECT( tmp_left_name_2 ); 281     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     }
305     {
306     PyObject *tmp_assign_source_5;
307     PyObject *tmp_left_name_3;
308     PyObject *tmp_right_name_3;
309     tmp_left_name_3 = var_s;
310  
311     CHECK_OBJECT( tmp_left_name_3 );
312     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 282     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
313 283
n 314     if (unlikely( tmp_right_name_3 == NULL )) n 284     if (unlikely( tmp_right_name_2 == NULL ))
315     { 285     {
n 316         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 286         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
317     } 287     }
318 288
n 319     if ( tmp_right_name_3 == NULL ) n 289     if ( tmp_right_name_2 == NULL )
320     { 290     {
321 291
322         exception_type = PyExc_NameError; 292         exception_type = PyExc_NameError;
323         Py_INCREF( exception_type ); 293         Py_INCREF( exception_type );
324         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 294         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
329         exception_lineno = 37; 299         exception_lineno = 37;
330         type_description_1 = "oo"; 300         type_description_1 = "oo";
331         goto frame_exception_exit_1; 301         goto frame_exception_exit_1;
332     } 302     }
333 303
n 334     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); n 304     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
335     tmp_assign_source_5 = tmp_left_name_3; 305     tmp_assign_source_4 = tmp_left_name_2;
336     if ( tmp_result == false ) 306     if ( tmp_result == false )
337     { 307     {
338         assert( ERROR_OCCURRED() ); 308         assert( ERROR_OCCURRED() );
339 309
340         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 310         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
342 312
343         exception_lineno = 37; 313         exception_lineno = 37;
344         type_description_1 = "oo"; 314         type_description_1 = "oo";
345         goto frame_exception_exit_1; 315         goto frame_exception_exit_1;
346     } 316     }
t 347     var_s = tmp_assign_source_5; t 317     var_s = tmp_assign_source_4;
348 318
349     } 319     }
350 320
351 #if 0 321 #if 0
352     RESTORE_FRAME_EXCEPTION( frame_f7e54cf08d4e1aa84f3861efd01035d2 ); 322     RESTORE_FRAME_EXCEPTION( frame_f7e54cf08d4e1aa84f3861efd01035d2 );