Construct InplaceOperationListAdd

Performance Diagrams

Construct InplaceOperationListAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)4135548188.95192307692307257.0CPython 2.723988296242.31730769230768360.77581150516755Nuitka (master)24000434395.6826923076923360.7032821459162Nuitka (develop)24003344549.0480769230769360.6858937429321Nuitka (factory)Construct InplaceOperationListAddTicks Construct InplaceOperationListAdd 0040000004000000800000080000001200000012000000160000001600000020000000200000002400000024000000280000002800000032000000320000003600000036000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3820148688.95192307692307257.0CPython 3.524855452242.31730769230768343.3319904623605Nuitka (master)24853773395.6826923076923343.34285147260425Nuitka (develop)24851565549.0480769230769343.35713444497947Nuitka (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
33 /* The declarations of module constants used, if any. */ 33 /* The declarations of 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;
37 static PyObject *const_str_digest_a06fd360a2a329ad09362ed11593d135; 37 static PyObject *const_str_digest_a06fd360a2a329ad09362ed11593d135;
n 38 static PyObject *const_list_float_1000_0_list; n
39 extern PyObject *const_str_plain___file__; 38 extern PyObject *const_str_plain___file__;
40 static PyObject *const_float_5_0; 39 static PyObject *const_float_5_0;
41 static PyObject *const_list_float_5_0_list; 40 static PyObject *const_list_float_5_0_list;
42 extern PyObject *const_int_0; 41 extern PyObject *const_int_0;
43 static PyObject *const_float_2_0; 42 static PyObject *const_float_2_0;
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;
74     const_str_plain_s = UNSTREAM_STRING_ASCII( &constant_bin[ 8 ], 1, 1 ); 72     const_str_plain_s = UNSTREAM_STRING_ASCII( &constant_bin[ 8 ], 1, 1 );
75     const_list_float_3_0_list = PyList_New( 1 ); 73     const_list_float_3_0_list = PyList_New( 1 );
76     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 9 ] ); 74     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 9 ] );
77     PyList_SET_ITEM( const_list_float_3_0_list, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 ); 75     PyList_SET_ITEM( const_list_float_3_0_list, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 );
78     const_str_digest_a06fd360a2a329ad09362ed11593d135 = UNSTREAM_STRING_ASCII( &constant_bin[ 17 ], 74, 0 ); 76     const_str_digest_a06fd360a2a329ad09362ed11593d135 = UNSTREAM_STRING_ASCII( &constant_bin[ 17 ], 74, 0 );
n 79     const_list_float_1000_0_list = PyList_New( 1 ); n
80     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 91 ] );
81     PyList_SET_ITEM( const_list_float_1000_0_list, 0, const_float_1000_0 ); Py_INCREF( const_float_1000_0 );
82     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 99 ] ); 77     const_float_5_0 = UNSTREAM_FLOAT( &constant_bin[ 91 ] );
83     const_list_float_5_0_list = PyList_New( 1 ); 78     const_list_float_5_0_list = PyList_New( 1 );
84     PyList_SET_ITEM( const_list_float_5_0_list, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 ); 79     PyList_SET_ITEM( const_list_float_5_0_list, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 );
n 85     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 107 ] ); n 80     const_float_2_0 = UNSTREAM_FLOAT( &constant_bin[ 99 ] );
86     const_str_plain_local_value = UNSTREAM_STRING_ASCII( &constant_bin[ 115 ], 11, 1 ); 81     const_str_plain_local_value = UNSTREAM_STRING_ASCII( &constant_bin[ 107 ], 11, 1 );
87     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 82     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
n 88     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII( &constant_bin[ 126 ], 13, 1 ); n 83     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII( &constant_bin[ 118 ], 13, 1 );
89     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 84     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 90     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 139 ], 3, 0 ); n 85     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 131 ], 3, 0 );
91     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 86     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 92     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII( &constant_bin[ 142 ], 13, 1 ); n 87     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII( &constant_bin[ 134 ], 13, 1 );
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_ASCII( &constant_bin[ 155 ], 16, 1 ); n 91     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 147 ], 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_ASCII( &constant_bin[ 171 ], 8, 0 ); n 94     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 163 ], 8, 0 );
100     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 179 ], 4, 1 ); 95     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 171 ], 4, 1 );
101     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 42 ], 1, 1 ); 96     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 42 ], 1, 1 );
n 102     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 183 ], 6, 1 ); n 97     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 175 ], 6, 1 );
103     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 98     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
104     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 99     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
105     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 100     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
106 101
107     constants_created = true; 102     constants_created = true;
282     } 277     }
283     { 278     {
284         PyObject *tmp_assign_source_4; 279         PyObject *tmp_assign_source_4;
285         PyObject *tmp_left_name_2; 280         PyObject *tmp_left_name_2;
286         PyObject *tmp_right_name_2; 281         PyObject *tmp_right_name_2;
n n 282         PyObject *tmp_mvar_value_4;
287         CHECK_OBJECT( var_s ); 283         CHECK_OBJECT( var_s );
288         tmp_left_name_2 = var_s; 284         tmp_left_name_2 = var_s;
n 289         tmp_right_name_2 = LIST_COPY( const_list_float_1000_0_list ); n
290         tmp_result = BINARY_OPERATION_ADD_OBJECT_LIST_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
291         Py_DECREF( tmp_right_name_2 );
292         if ( tmp_result == false )
293         {
294             assert( ERROR_OCCURRED() );
295  
296             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
297  
298  
299             exception_lineno = 35;
300             type_description_1 = "oo";
301             goto frame_exception_exit_1;
302         }
303         tmp_assign_source_4 = tmp_left_name_2;
304         var_s = tmp_assign_source_4;
305  
306     }
307     {
308         PyObject *tmp_assign_source_5;
309         PyObject *tmp_left_name_3;
310         PyObject *tmp_right_name_3;
311         PyObject *tmp_mvar_value_4;
312         CHECK_OBJECT( var_s );
313         tmp_left_name_3 = var_s;
314         tmp_mvar_value_4 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 285         tmp_mvar_value_4 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
315 286
316         if (unlikely( tmp_mvar_value_4 == NULL )) 287         if (unlikely( tmp_mvar_value_4 == NULL ))
317         { 288         {
318             tmp_mvar_value_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); 289             tmp_mvar_value_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
331             exception_lineno = 37; 302             exception_lineno = 37;
332             type_description_1 = "oo"; 303             type_description_1 = "oo";
333             goto frame_exception_exit_1; 304             goto frame_exception_exit_1;
334         } 305         }
335 306
n 336         tmp_right_name_3 = tmp_mvar_value_4; n 307         tmp_right_name_2 = tmp_mvar_value_4;
337         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); 308         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
338         if ( tmp_result == false ) 309         if ( tmp_result == false )
339         { 310         {
340             assert( ERROR_OCCURRED() ); 311             assert( ERROR_OCCURRED() );
341 312
342             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 313             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
344 315
345             exception_lineno = 37; 316             exception_lineno = 37;
346             type_description_1 = "oo"; 317             type_description_1 = "oo";
347             goto frame_exception_exit_1; 318             goto frame_exception_exit_1;
348         } 319         }
t 349         tmp_assign_source_5 = tmp_left_name_3; t 320         tmp_assign_source_4 = tmp_left_name_2;
350         var_s = tmp_assign_source_5; 321         var_s = tmp_assign_source_4;
351 322
352     } 323     }
353 324
354 #if 0 325 #if 0
355     RESTORE_FRAME_EXCEPTION( frame_ddff39d7aa4f6410809ec586566307f6 ); 326     RESTORE_FRAME_EXCEPTION( frame_ddff39d7aa4f6410809ec586566307f6 );