Construct InplaceOperationTupleAdd

Performance Diagrams

Construct InplaceOperationTupleAdd 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)2568157673.61538461538461257.0CPython 2.721450398196.30769230769232297.7135908966861Nuitka (historic)20450252319.0000000000001307.33727845626345Nuitka (master)20450363441.69230769230774307.336210382883Nuitka (develop)20450351564.3846153846155307.3363258502755Nuitka (factory)Construct InplaceOperationTupleAddTicks Construct InplaceOperationTupleAdd 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)2168110573.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)17100645319.0000000000001309.206847142495Nuitka (master)17096069441.69230769230774309.259003155761Nuitka (develop)17086645564.3846153846155309.3664153648995Nuitka (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

for x in xrange(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

for x in xrange(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 for x in xrange(50000): 41 for x in xrange(50000):

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;
84     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 82     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
85     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 137 ], 13, 1 ); 83     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 137 ], 13, 1 );
86     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 84     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
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 ); 85     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s );
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 ); 86     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 89     const_tuple_float_1000_0_tuple = PyTuple_New( 1 ); n
90     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 150 ] );
91     PyTuple_SET_ITEM( const_tuple_float_1000_0_tuple, 0, const_float_1000_0 ); Py_INCREF( const_float_1000_0 );
92     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 158 ], 16, 1 ); 87     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 150 ], 16, 1 );
93     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 174 ], 8, 0 ); 88     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 166 ], 8, 0 );
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[ 37 ], 1, 1 ); 91     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 37 ], 1, 1 );
n 97     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 182 ] ); n 92     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 174 ] );
98     const_tuple_float_3_0_tuple = PyTuple_New( 1 ); 93     const_tuple_float_3_0_tuple = PyTuple_New( 1 );
99     PyTuple_SET_ITEM( const_tuple_float_3_0_tuple, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 ); 94     PyTuple_SET_ITEM( const_tuple_float_3_0_tuple, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 );
100 95
101     constants_created = true; 96     constants_created = true;
102 } 97 }
148     PyTracebackObject *exception_keeper_tb_1; 143     PyTracebackObject *exception_keeper_tb_1;
149     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 144     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
150     PyObject *tmp_assign_source_1; 145     PyObject *tmp_assign_source_1;
151     PyObject *tmp_assign_source_2; 146     PyObject *tmp_assign_source_2;
152     PyObject *tmp_assign_source_3; 147     PyObject *tmp_assign_source_3;
n 153     PyObject *tmp_assign_source_4; n
154     PyObject *tmp_left_name_1; 148     PyObject *tmp_left_name_1;
155     PyObject *tmp_left_name_2; 149     PyObject *tmp_left_name_2;
n 156     PyObject *tmp_left_name_3; n
157     bool tmp_result; 150     bool tmp_result;
158     PyObject *tmp_return_value; 151     PyObject *tmp_return_value;
159     PyObject *tmp_right_name_1; 152     PyObject *tmp_right_name_1;
160     PyObject *tmp_right_name_2; 153     PyObject *tmp_right_name_2;
n 161     PyObject *tmp_right_name_3; n
162     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 154     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
163     static struct Nuitka_FrameObject *cache_frame_0d53607f7cf20205306d8a448e4ffa2d = NULL; 155     static struct Nuitka_FrameObject *cache_frame_0d53607f7cf20205306d8a448e4ffa2d = NULL;
164 156
165     struct Nuitka_FrameObject *frame_0d53607f7cf20205306d8a448e4ffa2d; 157     struct Nuitka_FrameObject *frame_0d53607f7cf20205306d8a448e4ffa2d;
166 158
266     var_s = tmp_assign_source_2; 258     var_s = tmp_assign_source_2;
267 259
268     tmp_left_name_2 = var_s; 260     tmp_left_name_2 = var_s;
269 261
270     CHECK_OBJECT( tmp_left_name_2 ); 262     CHECK_OBJECT( tmp_left_name_2 );
n 271     tmp_right_name_2 = const_tuple_float_1000_0_tuple; n
272     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
273     tmp_assign_source_3 = tmp_left_name_2;
274     if ( tmp_result == false )
275     {
276         assert( ERROR_OCCURRED() );
277  
278         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
279  
280  
281         exception_lineno = 35;
282         type_description = "oo";
283         goto frame_exception_exit_1;
284     }
285     var_s = tmp_assign_source_3;
286  
287     tmp_left_name_3 = var_s;
288  
289     CHECK_OBJECT( tmp_left_name_3 );
290     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 263     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
291 264
n 292     if (unlikely( tmp_right_name_3 == NULL )) n 265     if (unlikely( tmp_right_name_2 == NULL ))
293     { 266     {
n 294         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 267         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
295     } 268     }
296 269
n 297     if ( tmp_right_name_3 == NULL ) n 270     if ( tmp_right_name_2 == NULL )
298     { 271     {
299 272
300         exception_type = PyExc_NameError; 273         exception_type = PyExc_NameError;
301         Py_INCREF( exception_type ); 274         Py_INCREF( exception_type );
302         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 275         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
307         exception_lineno = 37; 280         exception_lineno = 37;
308         type_description = "oo"; 281         type_description = "oo";
309         goto frame_exception_exit_1; 282         goto frame_exception_exit_1;
310     } 283     }
311 284
n 312     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); n 285     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
313     tmp_assign_source_4 = tmp_left_name_3; 286     tmp_assign_source_3 = tmp_left_name_2;
314     if ( tmp_result == false ) 287     if ( tmp_result == false )
315     { 288     {
316         assert( ERROR_OCCURRED() ); 289         assert( ERROR_OCCURRED() );
317 290
318         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 291         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
320 293
321         exception_lineno = 37; 294         exception_lineno = 37;
322         type_description = "oo"; 295         type_description = "oo";
323         goto frame_exception_exit_1; 296         goto frame_exception_exit_1;
324     } 297     }
t 325     var_s = tmp_assign_source_4; t 298     var_s = tmp_assign_source_3;
326 299
327 300
328 #if 0 301 #if 0
329     RESTORE_FRAME_EXCEPTION( frame_0d53607f7cf20205306d8a448e4ffa2d ); 302     RESTORE_FRAME_EXCEPTION( frame_0d53607f7cf20205306d8a448e4ffa2d );
330 #endif 303 #endif