Construct InplaceOperationTupleAdd

Performance Diagrams

Construct InplaceOperationTupleAdd 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000220000002200000024000000240000002600000026000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)2734146988.95192307692307257.0CPython 2.715801191242.31730769230768361.30237806675495Nuitka (master)15801203395.6826923076923361.3022696093559Nuitka (develop)15801185549.0480769230769361.30243229545454Nuitka (factory)Construct InplaceOperationTupleAddTicks Construct InplaceOperationTupleAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2227642688.95192307692307257.0CPython 3.514950989242.31730769230768338.26205620824317Nuitka (master)14950873395.6826923076923338.26334301181816Nuitka (develop)14950783549.0480769230769338.2643413939022Nuitka (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;
85     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 83     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
86     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII( &constant_bin[ 127 ], 13, 1 ); 84     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII( &constant_bin[ 127 ], 13, 1 );
87     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 85     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
88     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s ); 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 );
89     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 ); 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 );
n 90     const_tuple_float_1000_0_tuple = PyTuple_New( 1 ); n
91     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 140 ] );
92     PyTuple_SET_ITEM( const_tuple_float_1000_0_tuple, 0, const_float_1000_0 ); Py_INCREF( const_float_1000_0 );
93     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 148 ], 16, 1 ); 88     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 140 ], 16, 1 );
94     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 164 ], 8, 0 ); 89     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 156 ], 8, 0 );
95     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 172 ], 4, 1 ); 90     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 164 ], 4, 1 );
96     const_tuple_float_5_0_tuple = PyTuple_New( 1 ); 91     const_tuple_float_5_0_tuple = PyTuple_New( 1 );
97     PyTuple_SET_ITEM( const_tuple_float_5_0_tuple, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 ); 92     PyTuple_SET_ITEM( const_tuple_float_5_0_tuple, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 );
98     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 34 ], 1, 1 ); 93     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 34 ], 1, 1 );
n 99     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 176 ], 6, 1 ); n 94     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 168 ], 6, 1 );
100     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 95     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
101     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 96     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
102     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 97     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 103     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 182 ] ); n 98     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 174 ] );
104     const_tuple_float_3_0_tuple = PyTuple_New( 1 ); 99     const_tuple_float_3_0_tuple = PyTuple_New( 1 );
105     PyTuple_SET_ITEM( const_tuple_float_3_0_tuple, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 ); 100     PyTuple_SET_ITEM( const_tuple_float_3_0_tuple, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 );
106 101
107     constants_created = true; 102     constants_created = true;
108 } 103 }
273     } 268     }
274     { 269     {
275         PyObject *tmp_assign_source_3; 270         PyObject *tmp_assign_source_3;
276         PyObject *tmp_left_name_2; 271         PyObject *tmp_left_name_2;
277         PyObject *tmp_right_name_2; 272         PyObject *tmp_right_name_2;
n n 273         PyObject *tmp_mvar_value_4;
278         CHECK_OBJECT( var_s ); 274         CHECK_OBJECT( var_s );
279         tmp_left_name_2 = var_s; 275         tmp_left_name_2 = var_s;
n 280         tmp_right_name_2 = const_tuple_float_1000_0_tuple; n
281         tmp_result = BINARY_OPERATION_ADD_OBJECT_TUPLE_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
282         if ( tmp_result == false )
283         {
284             assert( ERROR_OCCURRED() );
285  
286             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
287  
288  
289             exception_lineno = 35;
290             type_description_1 = "oo";
291             goto frame_exception_exit_1;
292         }
293         tmp_assign_source_3 = tmp_left_name_2;
294         var_s = tmp_assign_source_3;
295  
296     }
297     {
298         PyObject *tmp_assign_source_4;
299         PyObject *tmp_left_name_3;
300         PyObject *tmp_right_name_3;
301         PyObject *tmp_mvar_value_4;
302         CHECK_OBJECT( var_s );
303         tmp_left_name_3 = var_s;
304         tmp_mvar_value_4 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 276         tmp_mvar_value_4 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
305 277
306         if (unlikely( tmp_mvar_value_4 == NULL )) 278         if (unlikely( tmp_mvar_value_4 == NULL ))
307         { 279         {
308             tmp_mvar_value_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); 280             tmp_mvar_value_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
321             exception_lineno = 37; 293             exception_lineno = 37;
322             type_description_1 = "oo"; 294             type_description_1 = "oo";
323             goto frame_exception_exit_1; 295             goto frame_exception_exit_1;
324         } 296         }
325 297
n 326         tmp_right_name_3 = tmp_mvar_value_4; n 298         tmp_right_name_2 = tmp_mvar_value_4;
327         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); 299         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
328         if ( tmp_result == false ) 300         if ( tmp_result == false )
329         { 301         {
330             assert( ERROR_OCCURRED() ); 302             assert( ERROR_OCCURRED() );
331 303
332             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 304             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
334 306
335             exception_lineno = 37; 307             exception_lineno = 37;
336             type_description_1 = "oo"; 308             type_description_1 = "oo";
337             goto frame_exception_exit_1; 309             goto frame_exception_exit_1;
338         } 310         }
t 339         tmp_assign_source_4 = tmp_left_name_3; t 311         tmp_assign_source_3 = tmp_left_name_2;
340         var_s = tmp_assign_source_4; 312         var_s = tmp_assign_source_3;
341 313
342     } 314     }
343 315
344 #if 0 316 #if 0
345     RESTORE_FRAME_EXCEPTION( frame_7c39a07ec0f8f36f92f14a13521f00da ); 317     RESTORE_FRAME_EXCEPTION( frame_7c39a07ec0f8f36f92f14a13521f00da );