Construct InplaceOperationTupleAdd

Performance Diagrams

Construct InplaceOperationTupleAdd 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000220000002200000024000000240000002600000026000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)2749053288.95192307692307257.0CPython 2.720600706242.31730769230768318.9333959023811Nuitka (master)20700472395.6826923076923318.03658846840574Nuitka (develop)20700646549.0480769230769318.035024363465Nuitka (factory)Construct InplaceOperationTupleAddTicks Construct InplaceOperationTupleAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2217796488.95192307692307257.0CPython 3.516750511242.31730769230768317.4747638501408Nuitka (master)16801132395.6826923076923316.9107252447659Nuitka (develop)16787892549.0480769230769317.0582504049793Nuitka (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
44 static PyObject *const_str_plain_module_value2; 44 static PyObject *const_str_plain_module_value2;
45 static PyObject *const_tuple_float_2_0_tuple; 45 static PyObject *const_tuple_float_2_0_tuple;
46 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 46 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
47 static PyObject *const_str_plain_module_value1; 47 static PyObject *const_str_plain_module_value1;
48 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 48 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
n 49 static PyObject *const_tuple_float_1000_0_tuple; n
50 static PyObject *const_str_plain_calledRepeatedly; 49 static PyObject *const_str_plain_calledRepeatedly;
n 51 static PyObject *const_float_1000_0; n
52 static PyObject *const_str_angle_module; 50 static PyObject *const_str_angle_module;
53 static PyObject *const_str_plain_None; 51 static PyObject *const_str_plain_None;
54 static PyObject *const_tuple_float_5_0_tuple; 52 static PyObject *const_tuple_float_5_0_tuple;
55 static PyObject *const_str_plain_x; 53 static PyObject *const_str_plain_x;
56 extern PyObject *const_tuple_empty; 54 extern PyObject *const_tuple_empty;
83     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 81     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
84     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 134 ], 13, 1 ); 82     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 134 ], 13, 1 );
85     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 83     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
86     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s ); 84     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, 1, const_str_plain_local_value ); Py_INCREF( const_str_plain_local_value ); 85     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 88     const_tuple_float_1000_0_tuple = PyTuple_New( 1 ); n
89     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 147 ] );
90     PyTuple_SET_ITEM( const_tuple_float_1000_0_tuple, 0, const_float_1000_0 ); Py_INCREF( const_float_1000_0 );
91     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 155 ], 16, 1 ); 86     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 147 ], 16, 1 );
92     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 171 ], 8, 0 ); 87     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 163 ], 8, 0 );
93     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 179 ], 4, 1 ); 88     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 171 ], 4, 1 );
94     const_tuple_float_5_0_tuple = PyTuple_New( 1 ); 89     const_tuple_float_5_0_tuple = PyTuple_New( 1 );
95     PyTuple_SET_ITEM( const_tuple_float_5_0_tuple, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 ); 90     PyTuple_SET_ITEM( const_tuple_float_5_0_tuple, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 );
96     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 34 ], 1, 1 ); 91     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 34 ], 1, 1 );
n 97     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 183 ], 6, 1 ); n 92     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 175 ], 6, 1 );
98     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 93     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
99     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 94     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, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 95     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 101     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 189 ] ); n 96     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 181 ] );
102     const_tuple_float_3_0_tuple = PyTuple_New( 1 ); 97     const_tuple_float_3_0_tuple = PyTuple_New( 1 );
103     PyTuple_SET_ITEM( const_tuple_float_3_0_tuple, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 ); 98     PyTuple_SET_ITEM( const_tuple_float_3_0_tuple, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 );
104 99
105     constants_created = true; 100     constants_created = true;
106 } 101 }
273     PyObject *tmp_left_name_2; 268     PyObject *tmp_left_name_2;
274     PyObject *tmp_right_name_2; 269     PyObject *tmp_right_name_2;
275     tmp_left_name_2 = var_s; 270     tmp_left_name_2 = var_s;
276 271
277     CHECK_OBJECT( tmp_left_name_2 ); 272     CHECK_OBJECT( tmp_left_name_2 );
n 278     tmp_right_name_2 = const_tuple_float_1000_0_tuple; n
279     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
280     tmp_assign_source_3 = tmp_left_name_2;
281     if ( tmp_result == false )
282     {
283         assert( ERROR_OCCURRED() );
284  
285         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
286  
287  
288         exception_lineno = 35;
289         type_description_1 = "oo";
290         goto frame_exception_exit_1;
291     }
292     var_s = tmp_assign_source_3;
293  
294     }
295     {
296     PyObject *tmp_assign_source_4;
297     PyObject *tmp_left_name_3;
298     PyObject *tmp_right_name_3;
299     tmp_left_name_3 = var_s;
300  
301     CHECK_OBJECT( tmp_left_name_3 );
302     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 273     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
303 274
n 304     if (unlikely( tmp_right_name_3 == NULL )) n 275     if (unlikely( tmp_right_name_2 == NULL ))
305     { 276     {
n 306         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 277         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
307     } 278     }
308 279
n 309     if ( tmp_right_name_3 == NULL ) n 280     if ( tmp_right_name_2 == NULL )
310     { 281     {
311 282
312         exception_type = PyExc_NameError; 283         exception_type = PyExc_NameError;
313         Py_INCREF( exception_type ); 284         Py_INCREF( exception_type );
314         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 285         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
319         exception_lineno = 37; 290         exception_lineno = 37;
320         type_description_1 = "oo"; 291         type_description_1 = "oo";
321         goto frame_exception_exit_1; 292         goto frame_exception_exit_1;
322     } 293     }
323 294
n 324     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); n 295     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
325     tmp_assign_source_4 = tmp_left_name_3; 296     tmp_assign_source_3 = tmp_left_name_2;
326     if ( tmp_result == false ) 297     if ( tmp_result == false )
327     { 298     {
328         assert( ERROR_OCCURRED() ); 299         assert( ERROR_OCCURRED() );
329 300
330         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 301         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
332 303
333         exception_lineno = 37; 304         exception_lineno = 37;
334         type_description_1 = "oo"; 305         type_description_1 = "oo";
335         goto frame_exception_exit_1; 306         goto frame_exception_exit_1;
336     } 307     }
t 337     var_s = tmp_assign_source_4; t 308     var_s = tmp_assign_source_3;
338 309
339     } 310     }
340 311
341 #if 0 312 #if 0
342     RESTORE_FRAME_EXCEPTION( frame_0806687e81f3c7fecb243d83698ff5e5 ); 313     RESTORE_FRAME_EXCEPTION( frame_0806687e81f3c7fecb243d83698ff5e5 );