Construct InplaceOperationIntegerAdd

Performance Diagrams

Construct InplaceOperationIntegerAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1082529273.61538461538461257.0CPython 2.710050022196.30769230769232274.69754979641834Nuitka (historic)5750502319.0000000000001372.8452522751634Nuitka (master)5750660441.69230769230774372.8416455151084Nuitka (develop)5750132564.3846153846155372.8536984854187Nuitka (factory)Construct InplaceOperationIntegerAddTicks Construct InplaceOperationIntegerAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)2267208473.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)18146327319.0000000000001306.3286890490865Nuitka (master)18145825441.69230769230774306.33416062034024Nuitka (develop)18148673564.3846153846155306.30311871808794Nuitka (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
42 static PyObject *const_int_pos_3; 42 static PyObject *const_int_pos_3;
43 static PyObject *const_str_plain_local_value; 43 static PyObject *const_str_plain_local_value;
44 static PyObject *const_int_pos_50000; 44 static PyObject *const_int_pos_50000;
45 static PyObject *const_str_plain_module_value2; 45 static PyObject *const_str_plain_module_value2;
46 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 46 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
n 47 static PyObject *const_int_pos_1000; n
48 static PyObject *const_str_plain_module_value1; 47 static PyObject *const_str_plain_module_value1;
49 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;
50 static PyObject *const_str_plain_calledRepeatedly; 49 static PyObject *const_str_plain_calledRepeatedly;
51 static PyObject *const_str_angle_module; 50 static PyObject *const_str_angle_module;
52 static PyObject *const_str_plain_x; 51 static PyObject *const_str_plain_x;
72     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 12 ], 11, 1 ); 71     const_str_plain_local_value = UNSTREAM_STRING( &constant_bin[ 12 ], 11, 1 );
73     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 23 ], 13, 1 ); 72     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 23 ], 13, 1 );
74     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 73     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
75     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 36 ], 3, 0 ); 74     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 36 ], 3, 0 );
76     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 75     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 77     const_int_pos_1000 = PyLong_FromUnsignedLong( 1000ul ); n
78     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 39 ], 13, 1 ); 76     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 39 ], 13, 1 );
79     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 77     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
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 ); 78     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s );
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 ); 79     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 );
82     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 52 ], 16, 1 ); 80     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 52 ], 16, 1 );
136     PyTracebackObject *exception_keeper_tb_1; 134     PyTracebackObject *exception_keeper_tb_1;
137     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 135     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
138     PyObject *tmp_assign_source_1; 136     PyObject *tmp_assign_source_1;
139     PyObject *tmp_assign_source_2; 137     PyObject *tmp_assign_source_2;
140     PyObject *tmp_assign_source_3; 138     PyObject *tmp_assign_source_3;
n 141     PyObject *tmp_assign_source_4; n
142     PyObject *tmp_left_name_1; 139     PyObject *tmp_left_name_1;
143     PyObject *tmp_left_name_2; 140     PyObject *tmp_left_name_2;
n 144     PyObject *tmp_left_name_3; n
145     bool tmp_result; 141     bool tmp_result;
146     PyObject *tmp_return_value; 142     PyObject *tmp_return_value;
147     PyObject *tmp_right_name_1; 143     PyObject *tmp_right_name_1;
148     PyObject *tmp_right_name_2; 144     PyObject *tmp_right_name_2;
n 149     PyObject *tmp_right_name_3; n
150     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 145     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
151     static struct Nuitka_FrameObject *cache_frame_a9e1a6db28b23160e2ea19ca33477108 = NULL; 146     static struct Nuitka_FrameObject *cache_frame_a9e1a6db28b23160e2ea19ca33477108 = NULL;
152 147
153     struct Nuitka_FrameObject *frame_a9e1a6db28b23160e2ea19ca33477108; 148     struct Nuitka_FrameObject *frame_a9e1a6db28b23160e2ea19ca33477108;
154 149
254     var_s = tmp_assign_source_2; 249     var_s = tmp_assign_source_2;
255 250
256     tmp_left_name_2 = var_s; 251     tmp_left_name_2 = var_s;
257 252
258     CHECK_OBJECT( tmp_left_name_2 ); 253     CHECK_OBJECT( tmp_left_name_2 );
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     CHECK_OBJECT( tmp_left_name_3 );
278     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 );
279 255
n 280     if (unlikely( tmp_right_name_3 == NULL )) n 256     if (unlikely( tmp_right_name_2 == NULL ))
281     { 257     {
n 282         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 );
283     } 259     }
284 260
n 285     if ( tmp_right_name_3 == NULL ) n 261     if ( tmp_right_name_2 == NULL )
286     { 262     {
287 263
288         exception_type = PyExc_NameError; 264         exception_type = PyExc_NameError;
289         Py_INCREF( exception_type ); 265         Py_INCREF( exception_type );
290         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 266         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
295         exception_lineno = 37; 271         exception_lineno = 37;
296         type_description = "oo"; 272         type_description = "oo";
297         goto frame_exception_exit_1; 273         goto frame_exception_exit_1;
298     } 274     }
299 275
n 300     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 );
301     tmp_assign_source_4 = tmp_left_name_3; 277     tmp_assign_source_3 = tmp_left_name_2;
302     if ( tmp_result == false ) 278     if ( tmp_result == false )
303     { 279     {
304         assert( ERROR_OCCURRED() ); 280         assert( ERROR_OCCURRED() );
305 281
306         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 282         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
308 284
309         exception_lineno = 37; 285         exception_lineno = 37;
310         type_description = "oo"; 286         type_description = "oo";
311         goto frame_exception_exit_1; 287         goto frame_exception_exit_1;
312     } 288     }
t 313     var_s = tmp_assign_source_4; t 289     var_s = tmp_assign_source_3;
314 290
315 291
316 #if 0 292 #if 0
317     RESTORE_FRAME_EXCEPTION( frame_a9e1a6db28b23160e2ea19ca33477108 ); 293     RESTORE_FRAME_EXCEPTION( frame_a9e1a6db28b23160e2ea19ca33477108 );
318 #endif 294 #endif