Construct InplaceOperationTupleAdd

Performance Diagrams

Construct InplaceOperationTupleAdd 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000220000002200000024000000240000002600000026000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)2754058588.95192307692307257.0CPython 2.720600406242.31730769230768319.2726424614661Nuitka (master)20600388395.6826923076923319.2728039713586Nuitka (develop)20600442549.0480769230769319.272319441681Nuitka (factory)Construct InplaceOperationTupleAddTicks Construct InplaceOperationTupleAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2217980088.95192307692307257.0CPython 3.516756641242.31730769230768317.4219164336642Nuitka (master)16755977395.6826923076923317.4293143640055Nuitka (develop)16751153549.0480769230769317.4830607735937Nuitka (factory)Construct InplaceOperationTupleAddTicks

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
47 static PyObject *const_tuple_float_2_0_tuple; 47 static PyObject *const_tuple_float_2_0_tuple;
48 static PyObject *const_str_plain_module_value2; 48 static PyObject *const_str_plain_module_value2;
49 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 49 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
50 static PyObject *const_str_plain_module_value1; 50 static PyObject *const_str_plain_module_value1;
51 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;
n 52 static PyObject *const_tuple_float_1000_0_tuple; n
53 static PyObject *const_str_plain_calledRepeatedly; 52 static PyObject *const_str_plain_calledRepeatedly;
n 54 static PyObject *const_float_1000_0; n
55 static PyObject *const_str_angle_module; 53 static PyObject *const_str_angle_module;
56 static PyObject *const_tuple_float_5_0_tuple; 54 static PyObject *const_tuple_float_5_0_tuple;
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;
88     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 );
89     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 153 ], 13, 1 ); 87     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 153 ], 13, 1 );
90     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 );
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 ); 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 );
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 ); 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 93     const_tuple_float_1000_0_tuple = PyTuple_New( 1 ); n
94     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 166 ] );
95     PyTuple_SET_ITEM( const_tuple_float_1000_0_tuple, 0, const_float_1000_0 ); Py_INCREF( const_float_1000_0 );
96     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 174 ], 16, 1 ); 91     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 166 ], 16, 1 );
97     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 190 ], 8, 0 ); 92     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 182 ], 8, 0 );
98     const_tuple_float_5_0_tuple = PyTuple_New( 1 ); 93     const_tuple_float_5_0_tuple = PyTuple_New( 1 );
99     PyTuple_SET_ITEM( const_tuple_float_5_0_tuple, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 ); 94     PyTuple_SET_ITEM( const_tuple_float_5_0_tuple, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 );
100     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 53 ], 1, 1 ); 95     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 53 ], 1, 1 );
n 101     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 198 ], 6, 1 ); n 96     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 190 ], 6, 1 );
102     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 97     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
103     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 98     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
104     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 99     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 105     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 204 ] ); n 100     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 196 ] );
106     const_tuple_float_3_0_tuple = PyTuple_New( 1 ); 101     const_tuple_float_3_0_tuple = PyTuple_New( 1 );
107     PyTuple_SET_ITEM( const_tuple_float_3_0_tuple, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 ); 102     PyTuple_SET_ITEM( const_tuple_float_3_0_tuple, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 );
108 103
109     constants_created = true; 104     constants_created = true;
110 } 105 }
157     PyTracebackObject *exception_keeper_tb_1; 152     PyTracebackObject *exception_keeper_tb_1;
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;
n 162     PyObject *tmp_assign_source_4; n
163     PyObject *tmp_left_name_1; 157     PyObject *tmp_left_name_1;
164     PyObject *tmp_left_name_2; 158     PyObject *tmp_left_name_2;
n 165     PyObject *tmp_left_name_3; n
166     bool tmp_result; 159     bool tmp_result;
167     PyObject *tmp_return_value; 160     PyObject *tmp_return_value;
168     PyObject *tmp_right_name_1; 161     PyObject *tmp_right_name_1;
169     PyObject *tmp_right_name_2; 162     PyObject *tmp_right_name_2;
n 170     PyObject *tmp_right_name_3; n
171     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 163     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
172     static struct Nuitka_FrameObject *cache_frame_f8c69579fde9970ad81002dd61903674 = NULL; 164     static struct Nuitka_FrameObject *cache_frame_f8c69579fde9970ad81002dd61903674 = NULL;
173 165
174     struct Nuitka_FrameObject *frame_f8c69579fde9970ad81002dd61903674; 166     struct Nuitka_FrameObject *frame_f8c69579fde9970ad81002dd61903674;
175 167
275     var_s = tmp_assign_source_2; 267     var_s = tmp_assign_source_2;
276 268
277     tmp_left_name_2 = var_s; 269     tmp_left_name_2 = var_s;
278 270
279     CHECK_OBJECT( tmp_left_name_2 ); 271     CHECK_OBJECT( tmp_left_name_2 );
n 280     tmp_right_name_2 = const_tuple_float_1000_0_tuple; n
281     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
282     tmp_assign_source_3 = tmp_left_name_2;
283     if ( tmp_result == false )
284     {
285         assert( ERROR_OCCURRED() );
286  
287         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
288  
289  
290         exception_lineno = 35;
291         type_description_1 = "oo";
292         goto frame_exception_exit_1;
293     }
294     var_s = tmp_assign_source_3;
295  
296     tmp_left_name_3 = var_s;
297  
298     CHECK_OBJECT( tmp_left_name_3 );
299     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 272     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
300 273
n 301     if (unlikely( tmp_right_name_3 == NULL )) n 274     if (unlikely( tmp_right_name_2 == NULL ))
302     { 275     {
n 303         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 276         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
304     } 277     }
305 278
n 306     if ( tmp_right_name_3 == NULL ) n 279     if ( tmp_right_name_2 == NULL )
307     { 280     {
308 281
309         exception_type = PyExc_NameError; 282         exception_type = PyExc_NameError;
310         Py_INCREF( exception_type ); 283         Py_INCREF( exception_type );
311         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 284         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
316         exception_lineno = 37; 289         exception_lineno = 37;
317         type_description_1 = "oo"; 290         type_description_1 = "oo";
318         goto frame_exception_exit_1; 291         goto frame_exception_exit_1;
319     } 292     }
320 293
n 321     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); n 294     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
322     tmp_assign_source_4 = tmp_left_name_3; 295     tmp_assign_source_3 = tmp_left_name_2;
323     if ( tmp_result == false ) 296     if ( tmp_result == false )
324     { 297     {
325         assert( ERROR_OCCURRED() ); 298         assert( ERROR_OCCURRED() );
326 299
327         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 300         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
329 302
330         exception_lineno = 37; 303         exception_lineno = 37;
331         type_description_1 = "oo"; 304         type_description_1 = "oo";
332         goto frame_exception_exit_1; 305         goto frame_exception_exit_1;
333     } 306     }
t 334     var_s = tmp_assign_source_4; t 307     var_s = tmp_assign_source_3;
335 308
336 309
337 #if 0 310 #if 0
338     RESTORE_FRAME_EXCEPTION( frame_f8c69579fde9970ad81002dd61903674 ); 311     RESTORE_FRAME_EXCEPTION( frame_f8c69579fde9970ad81002dd61903674 );
339 #endif 312 #endif