Construct InplaceOperationIntegerAdd

Performance Diagrams

Construct InplaceOperationIntegerAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1082529273.61538461538461257.0CPython 2.710050022196.30769230769232274.69754979641834Nuitka (historic)5850582319.0000000000001370.5606665390643Nuitka (master)5850531441.69230769230774370.56183074642377Nuitka (develop)5750654564.3846153846155372.8417824806801Nuitka (factory)Construct InplaceOperationIntegerAddTicks Construct InplaceOperationIntegerAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)2267208473.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)18548256319.0000000000001301.9478460960048Nuitka (master)18549380441.69230769230774301.93559500817764Nuitka (develop)18449895564.3846153846155303.0199361758648Nuitka (factory)Construct InplaceOperationIntegerAddTicks

Source Code with Construct

module_value1 = 5
module_value2 = 3

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    # Make sure we have a local variable x anyway
    s = 2

    local_value = module_value1

    s += module_value1
# construct_begin
    s += 1000
# construct_end
    s += module_value2

    return s

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

module_value1 = 5
module_value2 = 3

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    # Make sure we have a local variable x anyway
    s = 2

    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 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
43 static PyObject *const_int_pos_3; 43 static PyObject *const_int_pos_3;
44 static PyObject *const_str_plain_local_value; 44 static PyObject *const_str_plain_local_value;
45 static PyObject *const_int_pos_50000; 45 static PyObject *const_int_pos_50000;
46 static PyObject *const_str_plain_module_value2; 46 static PyObject *const_str_plain_module_value2;
47 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 47 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
n 48 static PyObject *const_int_pos_1000; n
49 static PyObject *const_str_plain_module_value1; 48 static PyObject *const_str_plain_module_value1;
50 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 49 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
51 static PyObject *const_str_plain_calledRepeatedly; 50 static PyObject *const_str_plain_calledRepeatedly;
52 static PyObject *const_str_angle_module; 51 static PyObject *const_str_angle_module;
53 static PyObject *const_str_plain_x; 52 static PyObject *const_str_plain_x;
74     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 96 ], 11, 1 ); 73     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 96 ], 11, 1 );
75     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 107 ], 13, 1 ); 74     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 107 ], 13, 1 );
76     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 75     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
77     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 120 ], 3, 0 ); 76     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 120 ], 3, 0 );
78     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 77     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 79     const_int_pos_1000 = PyLong_FromUnsignedLong( 1000ul ); n
80     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 123 ], 13, 1 ); 78     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 123 ], 13, 1 );
81     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 79     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
82     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s ); 80     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s );
83     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 ); 81     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 );
84     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 136 ], 16, 1 ); 82     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 136 ], 16, 1 );
137     PyTracebackObject *exception_keeper_tb_1; 135     PyTracebackObject *exception_keeper_tb_1;
138     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 136     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
139     PyObject *tmp_assign_source_1; 137     PyObject *tmp_assign_source_1;
140     PyObject *tmp_assign_source_2; 138     PyObject *tmp_assign_source_2;
141     PyObject *tmp_assign_source_3; 139     PyObject *tmp_assign_source_3;
n 142     PyObject *tmp_assign_source_4; n
143     PyObject *tmp_left_name_1; 140     PyObject *tmp_left_name_1;
144     PyObject *tmp_left_name_2; 141     PyObject *tmp_left_name_2;
n 145     PyObject *tmp_left_name_3; n
146     bool tmp_result; 142     bool tmp_result;
147     PyObject *tmp_return_value; 143     PyObject *tmp_return_value;
148     PyObject *tmp_right_name_1; 144     PyObject *tmp_right_name_1;
149     PyObject *tmp_right_name_2; 145     PyObject *tmp_right_name_2;
n 150     PyObject *tmp_right_name_3; n
151     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 146     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
152     static struct Nuitka_FrameObject *cache_frame_function = NULL; 147     static struct Nuitka_FrameObject *cache_frame_function = NULL;
153 148
154     struct Nuitka_FrameObject *frame_function; 149     struct Nuitka_FrameObject *frame_function;
155 150
254     assert( var_s == NULL ); 249     assert( var_s == NULL );
255     var_s = tmp_assign_source_2; 250     var_s = tmp_assign_source_2;
256 251
257     tmp_left_name_2 = var_s; 252     tmp_left_name_2 = var_s;
258 253
n 259     tmp_right_name_2 = const_int_pos_1000; n
260     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
261     tmp_assign_source_3 = tmp_left_name_2;
262     if ( tmp_result == false )
263     {
264         assert( ERROR_OCCURRED() );
265  
266         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
267  
268  
269         exception_lineno = 35;
270         type_description = "oo";
271         goto frame_exception_exit_1;
272     }
273     var_s = tmp_assign_source_3;
274  
275     tmp_left_name_3 = var_s;
276  
277     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 254     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
278 255
n 279     if (unlikely( tmp_right_name_3 == NULL )) n 256     if (unlikely( tmp_right_name_2 == NULL ))
280     { 257     {
n 281         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 258         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
282     } 259     }
283 260
n 284     if ( tmp_right_name_3 == NULL ) n 261     if ( tmp_right_name_2 == NULL )
285     { 262     {
286 263
287         exception_type = PyExc_NameError; 264         exception_type = PyExc_NameError;
288         Py_INCREF( exception_type ); 265         Py_INCREF( exception_type );
289         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 266         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
294         exception_lineno = 37; 271         exception_lineno = 37;
295         type_description = "oo"; 272         type_description = "oo";
296         goto frame_exception_exit_1; 273         goto frame_exception_exit_1;
297     } 274     }
298 275
n 299     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); n 276     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
300     tmp_assign_source_4 = tmp_left_name_3; 277     tmp_assign_source_3 = tmp_left_name_2;
301     if ( tmp_result == false ) 278     if ( tmp_result == false )
302     { 279     {
303         assert( ERROR_OCCURRED() ); 280         assert( ERROR_OCCURRED() );
304 281
305         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 282         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
307 284
308         exception_lineno = 37; 285         exception_lineno = 37;
309         type_description = "oo"; 286         type_description = "oo";
310         goto frame_exception_exit_1; 287         goto frame_exception_exit_1;
311     } 288     }
t 312     var_s = tmp_assign_source_4; t 289     var_s = tmp_assign_source_3;
313 290
314 291
315 #if 0 292 #if 0
316     RESTORE_FRAME_EXCEPTION( frame_function ); 293     RESTORE_FRAME_EXCEPTION( frame_function );
317 #endif 294 #endif