Construct InplaceOperationTupleAdd

Performance Diagrams

Construct InplaceOperationTupleAdd 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)2568157673.61538461538461257.0CPython 2.721450398196.30769230769232297.7135908966861Nuitka (historic)20650099319.0000000000001305.4142941242571Nuitka (master)20650183441.69230769230774305.4134858525098Nuitka (develop)20650225564.3846153846155305.41308171663604Nuitka (factory)Construct InplaceOperationTupleAddTicks Construct InplaceOperationTupleAdd 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)2168110573.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)17188099319.0000000000001308.2100700480548Nuitka (master)17200866441.69230769230774308.06455522695205Nuitka (develop)17199238564.3846153846155308.0831107316717Nuitka (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;
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( &constant_bin[ 137 ], 13, 1 ); 84     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 137 ], 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[ 150 ] );
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( &constant_bin[ 158 ], 16, 1 ); 88     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 150 ], 16, 1 );
94     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 174 ], 8, 0 ); 89     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 166 ], 8, 0 );
95     const_tuple_float_5_0_tuple = PyTuple_New( 1 ); 90     const_tuple_float_5_0_tuple = PyTuple_New( 1 );
96     PyTuple_SET_ITEM( const_tuple_float_5_0_tuple, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 ); 91     PyTuple_SET_ITEM( const_tuple_float_5_0_tuple, 0, const_float_5_0 ); Py_INCREF( const_float_5_0 );
97     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 37 ], 1, 1 ); 92     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 37 ], 1, 1 );
n 98     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 182 ] ); n 93     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 174 ] );
99     const_tuple_float_3_0_tuple = PyTuple_New( 1 ); 94     const_tuple_float_3_0_tuple = PyTuple_New( 1 );
100     PyTuple_SET_ITEM( const_tuple_float_3_0_tuple, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 ); 95     PyTuple_SET_ITEM( const_tuple_float_3_0_tuple, 0, const_float_3_0 ); Py_INCREF( const_float_3_0 );
101 96
102     constants_created = true; 97     constants_created = true;
103 } 98 }
149     PyTracebackObject *exception_keeper_tb_1; 144     PyTracebackObject *exception_keeper_tb_1;
150     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 145     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
151     PyObject *tmp_assign_source_1; 146     PyObject *tmp_assign_source_1;
152     PyObject *tmp_assign_source_2; 147     PyObject *tmp_assign_source_2;
153     PyObject *tmp_assign_source_3; 148     PyObject *tmp_assign_source_3;
n 154     PyObject *tmp_assign_source_4; n
155     PyObject *tmp_frame_locals; 149     PyObject *tmp_frame_locals;
156     PyObject *tmp_left_name_1; 150     PyObject *tmp_left_name_1;
157     PyObject *tmp_left_name_2; 151     PyObject *tmp_left_name_2;
n 158     PyObject *tmp_left_name_3; n
159     bool tmp_result; 152     bool tmp_result;
160     PyObject *tmp_return_value; 153     PyObject *tmp_return_value;
161     PyObject *tmp_right_name_1; 154     PyObject *tmp_right_name_1;
162     PyObject *tmp_right_name_2; 155     PyObject *tmp_right_name_2;
n 163     PyObject *tmp_right_name_3; n
164     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 156     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
165     static PyFrameObject *cache_frame_function = NULL; 157     static PyFrameObject *cache_frame_function = NULL;
166 158
167     PyFrameObject *frame_function; 159     PyFrameObject *frame_function;
168 160
267     assert( var_s == NULL ); 259     assert( var_s == NULL );
268     var_s = tmp_assign_source_2; 260     var_s = tmp_assign_source_2;
269 261
270     tmp_left_name_2 = var_s; 262     tmp_left_name_2 = var_s;
271 263
n 272     tmp_right_name_2 = const_tuple_float_1000_0_tuple; n
273     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
274     tmp_assign_source_3 = tmp_left_name_2;
275     if ( tmp_result == false )
276     {
277         assert( ERROR_OCCURRED() );
278  
279         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
280  
281  
282         exception_lineno = 35;
283         goto frame_exception_exit_1;
284     }
285     var_s = tmp_assign_source_3;
286  
287     tmp_left_name_3 = var_s;
288  
289     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 264     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
290 265
n 291     if (unlikely( tmp_right_name_3 == NULL )) n 266     if (unlikely( tmp_right_name_2 == NULL ))
292     { 267     {
n 293         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 268         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
294     } 269     }
295 270
n 296     if ( tmp_right_name_3 == NULL ) n 271     if ( tmp_right_name_2 == NULL )
297     { 272     {
298 273
299         exception_type = PyExc_NameError; 274         exception_type = PyExc_NameError;
300         Py_INCREF( exception_type ); 275         Py_INCREF( exception_type );
301         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 276         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
305 280
306         exception_lineno = 37; 281         exception_lineno = 37;
307         goto frame_exception_exit_1; 282         goto frame_exception_exit_1;
308     } 283     }
309 284
n 310     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 );
311     tmp_assign_source_4 = tmp_left_name_3; 286     tmp_assign_source_3 = tmp_left_name_2;
312     if ( tmp_result == false ) 287     if ( tmp_result == false )
313     { 288     {
314         assert( ERROR_OCCURRED() ); 289         assert( ERROR_OCCURRED() );
315 290
316         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 291         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
317 292
318 293
319         exception_lineno = 37; 294         exception_lineno = 37;
320         goto frame_exception_exit_1; 295         goto frame_exception_exit_1;
321     } 296     }
t 322     var_s = tmp_assign_source_4; t 297     var_s = tmp_assign_source_3;
323 298
324 299
325 #if 0 300 #if 0
326     RESTORE_FRAME_EXCEPTION( frame_function ); 301     RESTORE_FRAME_EXCEPTION( frame_function );
327 #endif 302 #endif